How to use almostBlack method in Playwright Internal

Best JavaScript code snippet using playwright-internal

BookScreen.js

Source:BookScreen.js Github

copy

Full Screen

1import React, { useEffect, useState } from 'react'2import { View, Text, TouchableOpacity } from 'react-native'3import { responsiveFontSize, responsiveWidth } from 'react-native-responsive-dimensions'4import { bookCarApi } from '../Api/FirebaseApi'5import Header from '../Components/Header'6import NativeButton from '../Components/NativeButton'7import { almostBlack, backgroundColor, lightGrey, primaryColor, white } from '../Theme/colors'8import { PoppinsBold, PoppinsMedium, PoppinsRegular, PoppinsSemiBold } from '../Theme/fonts'9import { parseDateStr } from '../Utils/dateParser'10import './Homescreen.css'11export default function BookScreen({12 navigation,13 route14}) {15 const {16 car,17 location,18 startDate = new Date(),19 startTime,20 dropDate = new Date(),21 dropTime22 } = route.params23 const bookCar = () => {24 bookCarApi({25 car,26 location,27 startDate,28 startTime,29 dropDate,30 dropTime,31 bill: {32 subTotal: subTotal,33 tax: tax,34 total: total35 }36 }).then(() => {37 alert('Booking Successfull!')38 navigation.popToTop()39 }).catch(err => {40 console.log(err)41 alert('Something is not right. please try again!')42 })43 }44 const [withFuel, setWithFuel] = useState(true)45 const [subTotal, setSubTotal] = useState(0)46 const [tax, setTax] = useState(0)47 const [total, setTotal] = useState(0)48 useEffect(() => {49 const sub = getSubTotal()50 const tx = getTax(sub)51 setSubTotal(sub)52 setTax(tx)53 console.log(sub)54 console.log(tx)55 console.log(Math.abs(Number(sub) + Number(tx) + 200))56 setTotal(Math.abs(Number(sub) + Number(tx) + 200).toFixed(2))57 }, [withFuel])58 const getTax = (tx) => {59 return Math.round(tx * 0.18)60 }61 const getSubTotal = () => {62 const baseCharge = withFuel ? car?.withfuel : car.withoutfuel63 const sDate = new Date()64 const startSplit = startTime.label.split(':')65 sDate.setHours(startSplit[0])66 sDate.setMinutes(startSplit[1])67 const eDate = new Date()68 const endSplit = dropTime.label.split(':')69 eDate.setHours(endSplit[0])70 eDate.setMinutes(endSplit[1])71 const totalHours = diff_hours(sDate, eDate)72 return (Number(baseCharge) * totalHours).toFixed(2)73 }74 const diff_hours = (dt2, dt1) => {75 var diff = (dt2.getTime() - dt1.getTime()) / 1000;76 diff /= (60 * 60);77 return Math.abs(Math.round(diff));78 }79 return (80 <View style={{81 flex: 1,82 backgroundColor: backgroundColor83 }}>84 <Header85 title='Book Car'86 leftButton={require('../Assets/images/back.png')}87 leftButtonOnPress={() => navigation.goBack()}88 />89 <div className='cardetails'>90 <View style={{91 flex: 1,92 justifyContent: 'center',93 alignItems: 'center'94 }}>95 <View style={{96 padding: 20,97 backgroundColor: white,98 shadowColor: '#000',99 shadowOffset: { width: 5, height: 5 },100 shadowOpacity: 0.3,101 shadowRadius: 2,102 }}>103 <Text style={{104 fontFamily: PoppinsBold,105 color: almostBlack,106 fontSize: 24,107 textTransform: 'capitalize',108 borderBottomColor: almostBlack,109 borderBottomWidth: 2110 }}>111 Booking Confirmation112 </Text>113 <View style={{114 flexDirection: 'row',115 marginTop: 10116 }}>117 <View style={{118 padding: 10,119 borderRightColor: backgroundColor,120 borderRightWidth: 2121 }}>122 <Text style={{123 fontFamily: PoppinsSemiBold,124 color: almostBlack,125 fontSize: 18,126 }}>127 Car128 </Text>129 <View style={{130 width: responsiveWidth(30),131 backgroundColor: backgroundColor,132 borderRadius: 5,133 padding: 10,134 }}>135 <Text style={{136 fontFamily: PoppinsRegular,137 color: almostBlack,138 fontSize: 16,139 // fontStyle : 'italic'140 }}>141 {car.name}142 </Text>143 </View>144 <Text style={{145 fontFamily: PoppinsSemiBold,146 color: almostBlack,147 fontSize: 18,148 marginTop: 10149 }}>150 Location151 </Text>152 <View style={{153 width: responsiveWidth(30),154 backgroundColor: backgroundColor,155 borderRadius: 5,156 padding: 10,157 }}>158 <Text style={{159 fontFamily: PoppinsRegular,160 color: almostBlack,161 fontSize: 16,162 // fontStyle : 'italic'163 }}>164 {location}165 </Text>166 </View>167 <Text style={{168 fontFamily: PoppinsSemiBold,169 color: almostBlack,170 fontSize: 18,171 marginTop: 10172 }}>173 Pickup At,174 </Text>175 <View style={{176 width: responsiveWidth(30),177 backgroundColor: backgroundColor,178 borderRadius: 5,179 padding: 10,180 }}>181 <Text style={{182 fontFamily: PoppinsRegular,183 color: almostBlack,184 fontSize: 16,185 // fontStyle : 'italic'186 }}>187 {startTime.value}, {parseDateStr(startDate)}188 </Text>189 </View>190 <Text style={{191 fontFamily: PoppinsSemiBold,192 color: almostBlack,193 fontSize: 18,194 marginTop: 10195 }}>196 Drop At197 </Text>198 <View style={{199 width: responsiveWidth(30),200 backgroundColor: backgroundColor,201 borderRadius: 5,202 padding: 10,203 }}>204 <Text style={{205 fontFamily: PoppinsRegular,206 color: almostBlack,207 fontSize: 16,208 // fontStyle : 'italic'209 }}>210 {dropTime.value}, {parseDateStr(dropDate)}211 </Text>212 </View>213 </View>214 <View style={{215 padding: 10,216 width: responsiveWidth(25),217 }}>218 <View style={{219 padding: 10,220 marginVertical: responsiveWidth(2.5),221 flexDirection: 'row',222 justifyContent: 'space-between'223 }}>224 <Text style={{225 fontFamily: PoppinsSemiBold,226 color: almostBlack,227 fontSize: 18,228 }}>With Fuel</Text>229 <TouchableOpacity230 onPress={() => setWithFuel(!withFuel)}231 style={{232 width: responsiveWidth(5),233 height: responsiveWidth(2.5),234 backgroundColor: white,235 borderColor: lightGrey,236 borderWidth: 1,237 borderRadius: 5,238 alignItems: withFuel ? 'flex-start' : 'flex-end'239 }}>240 <View style={{241 width: responsiveWidth(2.5),242 height: '100%',243 backgroundColor: primaryColor244 }} />245 </TouchableOpacity>246 <Text style={{247 fontFamily: PoppinsSemiBold,248 color: almostBlack,249 fontSize: 18,250 }}>Without Fuel</Text>251 </View>252 <View style={{253 borderBottomColor: backgroundColor,254 borderBottomWidth: 2,255 }}>256 <Text style={{257 fontFamily: PoppinsSemiBold,258 color: almostBlack,259 fontSize: 18,260 textTransform: 'capitalize',261 marginHorizontal: 10262 }}>263 Bill Details264 </Text>265 </View>266 <View style={{267 flexDirection: 'row',268 justifyContent: 'space-between',269 alignItems: 'center',270 borderBottomColor: backgroundColor,271 borderBottomWidth: 1,272 marginTop: 10,273 paddingHorizontal: 10274 }}>275 <Text style={{276 fontFamily: PoppinsRegular,277 color: almostBlack,278 fontSize: 16,279 // fontStyle : 'italic'280 }}>281 SubTotal282 </Text>283 <Text style={{284 fontFamily: PoppinsRegular,285 color: almostBlack,286 fontSize: 16,287 // fontStyle : 'italic'288 }}>289 {`\u20b9`}{subTotal}290 </Text>291 </View>292 <View style={{293 flexDirection: 'row',294 justifyContent: 'space-between',295 alignItems: 'center',296 borderBottomColor: backgroundColor,297 borderBottomWidth: 1,298 marginTop: 10,299 paddingHorizontal: 10300 }}>301 <Text style={{302 fontFamily: PoppinsRegular,303 color: almostBlack,304 fontSize: 16,305 // fontStyle : 'italic'306 }}>307 Tax (18%)308 </Text>309 <Text style={{310 fontFamily: PoppinsRegular,311 color: almostBlack,312 fontSize: 16,313 // fontStyle : 'italic'314 }}>315 {`\u20b9`}{tax}316 </Text>317 </View>318 <View style={{319 flexDirection: 'row',320 justifyContent: 'space-between',321 alignItems: 'center',322 borderBottomColor: backgroundColor,323 borderBottomWidth: 1,324 marginTop: 10,325 paddingHorizontal: 10326 }}>327 <Text style={{328 fontFamily: PoppinsRegular,329 color: almostBlack,330 fontSize: 16,331 // fontStyle : 'italic'332 }}>333 Convinience Fee334 </Text>335 <Text style={{336 fontFamily: PoppinsRegular,337 color: almostBlack,338 fontSize: 16,339 // fontStyle : 'italic'340 }}>341 {`\u20b9`}200342 </Text>343 </View>344 <View style={{345 flexDirection: 'row',346 justifyContent: 'space-between',347 alignItems: 'center',348 borderBottomColor: backgroundColor,349 borderBottomWidth: 1,350 marginTop: 10,351 paddingHorizontal: 10352 }}>353 <Text style={{354 fontFamily: PoppinsSemiBold,355 color: almostBlack,356 fontSize: 18,357 // fontStyle : 'italic'358 }}>359 Total360 </Text>361 <Text style={{362 fontFamily: PoppinsSemiBold,363 color: almostBlack,364 fontSize: 18,365 // fontStyle : 'italic'366 }}>367 {`\u20b9`}{total}368 </Text>369 </View>370 <NativeButton371 onPress={bookCar}372 title='Book Now'373 buttonStyle={{374 width: '95%',375 padding: 5,376 backgroundColor: primaryColor,377 justifyContent: "center",378 alignItems: 'center',379 alignSelf: 'center',380 marginTop: 10,381 }}382 textStyle={{383 fontFamily: PoppinsBold,384 fontSize: responsiveFontSize(1.5),385 color: white386 }}387 />388 </View>389 </View>390 </View>391 </View>392 </div>393 </View>394 )...

Full Screen

Full Screen

OrderHistoryScreen.js

Source:OrderHistoryScreen.js Github

copy

Full Screen

1import React, { useEffect, useState } from 'react'2import { View, Text, ScrollView, Image } from 'react-native'3import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'4import { getBookingsApi } from '../Api/FirebaseApi'5import Header from '../Components/Header'6import { almostBlack, backgroundColor, grey, white } from '../Theme/colors'7import { PoppinsBold, PoppinsRegular, PoppinsSemiBold } from '../Theme/fonts'8import './Homescreen.css'9export default function OrderHistoryScreen({10 navigation11}) {12 const [bookings, setBookings] = useState([])13 useEffect(() => {14 getBookingsApi().then(doc => {15 setBookings(doc?.orders || [])16 }).catch(err => {17 alert(err.toString())18 })19 }, [])20 return (21 <View style={{22 flex: 1,23 backgroundColor: backgroundColor24 }}>25 <Header26 title='Order History'27 leftButton={require('../Assets/images/back.png')}28 leftButtonOnPress={() => navigation.goBack()}29 />30 <div className='cardetails'>31 </div>32 <View style={{33 position: 'absolute',34 left: 0,35 right: 0,36 top: responsiveHeight(10),37 bottom: responsiveHeight(8),38 justifyContent: 'center',39 alignItems: 'center',40 padding: 2041 }}>42 <ScrollView>43 <View style={{44 width: responsiveWidth(75),45 backgroundColor: white,46 borderRadius: 5,47 }}>48 {49 bookings.map((itm,idx) => (50 <OrderHistoryComp order={itm} index={idx} />51 ))52 }53 </View>54 </ScrollView>55 </View>56 </View>57 )58}59const OrderHistoryComp = ({ order = {}, index }) => {60 const {61 car,62 location,63 startDate = new Date(),64 startTime,65 dropDate = new Date(),66 dropTime67 } = order68 const {69 subTotal,70 tax,71 total72 } = order.bill73 return (74 <View style={{75 width: '90%',76 padding: responsiveHeight(2.5),77 borderColor: grey,78 borderBottomWidth: 1,79 alignSelf: 'center',80 margin: responsiveHeight(2.5),81 flexDirection: 'row'82 }}>83 <Text style={{84 fontFamily : PoppinsBold,85 color : grey,86 fontSize : 2287 }}>#{index+1}</Text>88 <View style={{89 justifyContent: 'center'90 }}>91 <Image92 source={getImage(order.car.name)}93 style={{94 height: responsiveHeight(15),95 width: responsiveHeight(15),96 }}97 />98 </View>99 <View style={{100 flex: 2,101 flexDirection: 'row',102 flexWrap: 'wrap',103 alignItems: 'center'104 }}>105 <View style={{106 width: '45%',107 marginHorizontal: '2%'108 }}>109 <Text style={{110 fontFamily: PoppinsSemiBold,111 color: almostBlack,112 fontSize: 18,113 }}>114 Car115 </Text>116 <View style={{117 width: '100%',118 backgroundColor: backgroundColor,119 borderRadius: 5,120 padding: 10,121 }}>122 <Text style={{123 fontFamily: PoppinsRegular,124 color: almostBlack,125 fontSize: 16,126 // fontStyle : 'italic'127 }}>128 {car.name}129 </Text>130 </View>131 </View>132 <View style={{133 width: '45%',134 marginHorizontal: '2%'135 }}>136 <Text style={{137 fontFamily: PoppinsSemiBold,138 color: almostBlack,139 fontSize: 18,140 marginTop: 10141 }}>142 Location143 </Text>144 <View style={{145 width: '100%',146 backgroundColor: backgroundColor,147 borderRadius: 5,148 padding: 10,149 }}>150 <Text style={{151 fontFamily: PoppinsRegular,152 color: almostBlack,153 fontSize: 16,154 // fontStyle : 'italic'155 }}>156 {location}157 </Text>158 </View>159 </View>160 <View style={{161 width: '45%',162 marginHorizontal: '2%'163 }}>164 <Text style={{165 fontFamily: PoppinsSemiBold,166 color: almostBlack,167 fontSize: 18,168 marginTop: 10169 }}>170 Pickup At,171 </Text>172 <View style={{173 width: '100%',174 backgroundColor: backgroundColor,175 borderRadius: 5,176 padding: 10,177 }}>178 <Text style={{179 fontFamily: PoppinsRegular,180 color: almostBlack,181 fontSize: 16,182 // fontStyle : 'italic'183 }}>184 {startTime.value},185 </Text>186 </View>187 </View>188 <View style={{189 width: '45%',190 marginHorizontal: '2%'191 }}>192 <Text style={{193 fontFamily: PoppinsSemiBold,194 color: almostBlack,195 fontSize: 18,196 marginTop: 10197 }}>198 Drop At199 </Text>200 <View style={{201 width: '100%',202 backgroundColor: backgroundColor,203 borderRadius: 5,204 padding: 10,205 }}>206 <Text style={{207 fontFamily: PoppinsRegular,208 color: almostBlack,209 fontSize: 16,210 // fontStyle : 'italic'211 }}>212 {dropTime.value},213 </Text>214 </View>215 </View>216 </View>217 <View style={{218 flex: 1,219 transform : [220 {221 scale : 0.8222 }223 ]224 }}>225 <View style={{226 borderBottomColor: backgroundColor,227 borderBottomWidth: 2,228 }}>229 <Text style={{230 fontFamily: PoppinsSemiBold,231 color: almostBlack,232 fontSize: 18,233 textTransform: 'capitalize',234 marginHorizontal: 10235 }}>236 Bill Details237 </Text>238 </View>239 <View style={{240 flexDirection: 'row',241 justifyContent: 'space-between',242 alignItems: 'center',243 borderBottomColor: backgroundColor,244 borderBottomWidth: 1,245 marginTop: 10,246 paddingHorizontal: 10247 }}>248 <Text style={{249 fontFamily: PoppinsRegular,250 color: almostBlack,251 fontSize: 16,252 // fontStyle : 'italic'253 }}>254 SubTotal255 </Text>256 <Text style={{257 fontFamily: PoppinsRegular,258 color: almostBlack,259 fontSize: 16,260 // fontStyle : 'italic'261 }}>262 {`\u20b9`}{subTotal}263 </Text>264 </View>265 <View style={{266 flexDirection: 'row',267 justifyContent: 'space-between',268 alignItems: 'center',269 borderBottomColor: backgroundColor,270 borderBottomWidth: 1,271 marginTop: 10,272 paddingHorizontal: 10273 }}>274 <Text style={{275 fontFamily: PoppinsRegular,276 color: almostBlack,277 fontSize: 16,278 // fontStyle : 'italic'279 }}>280 Tax (18%)281 </Text>282 <Text style={{283 fontFamily: PoppinsRegular,284 color: almostBlack,285 fontSize: 16,286 // fontStyle : 'italic'287 }}>288 {`\u20b9`}{tax}289 </Text>290 </View>291 <View style={{292 flexDirection: 'row',293 justifyContent: 'space-between',294 alignItems: 'center',295 borderBottomColor: backgroundColor,296 borderBottomWidth: 1,297 marginTop: 10,298 paddingHorizontal: 10299 }}>300 <Text style={{301 fontFamily: PoppinsRegular,302 color: almostBlack,303 fontSize: 16,304 // fontStyle : 'italic'305 }}>306 Convinience Fee307 </Text>308 <Text style={{309 fontFamily: PoppinsRegular,310 color: almostBlack,311 fontSize: 16,312 // fontStyle : 'italic'313 }}>314 {`\u20b9`}200315 </Text>316 </View>317 <View style={{318 flexDirection: 'row',319 justifyContent: 'space-between',320 alignItems: 'center',321 borderBottomColor: backgroundColor,322 borderBottomWidth: 1,323 marginTop: 10,324 paddingHorizontal: 10325 }}>326 <Text style={{327 fontFamily: PoppinsSemiBold,328 color: almostBlack,329 fontSize: 18,330 // fontStyle : 'italic'331 }}>332 Total333 </Text>334 <Text style={{335 fontFamily: PoppinsSemiBold,336 color: almostBlack,337 fontSize: 18,338 // fontStyle : 'italic'339 }}>340 {`\u20b9`}{total}341 </Text>342 </View>343 </View>344 </View>345 )346}347const getImage = name => {348 switch (name) {349 case 'Urus':350 return Urus;351 case 'Amg GT':352 return Amg_GT;353 case 'A6':354 return A6;355 case 'Minicoopermini':356 return Minicoopermini;357 case 'SLS':358 return SLS;359 case 'Mustang':360 return Mustang;361 case 'Roadster':362 return Roadster;363 case 'astonmartinDBX':364 return astonmartinDBX;365 case 'M6 competition':366 return M6_competition;367 case 'Evoque':368 return Evoque;369 case 'G43':370 return G43;371 case 'Ftype':372 return Ftype;373 default:374 return require('../../assets/toyota.png');375 }376}377const Urus = require('../../assets/lamborginiUrus.png');378const Amg_GT = require('../../assets/mercedezbenzamg.png');379const A6 = require('../../assets/AudiA6.png');380const Minicoopermini = require('../../assets/minicooper.png');381const SLS = require('../../assets/mercdezbenz_Sls.png');382const Mustang = require('../../assets/fordMustang.png');383const Roadster = require('../../assets/lamborginiroadster.png');384const astonmartinDBX = require('../../assets/astonmartin.png');385const M6_competition = require('../../assets/BMW_m6.png');386const Evoque = require('../../assets/rangerroverEvoque.png');387const G43 = require('../../assets/mercedezbenzGWagon.png');388const Ftype = require('../../assets/jaguar_Ftype.png');389const lambo = require('../Assets/images/brands/lambo.png')390const audi = require('../Assets/images/brands/audi.png')391const bmw = require('../Assets/images/brands/bmw.png')392const aston = require('../Assets/images/brands/aston.png')393const ford = require('../Assets/images/brands/ford.png')394const jaguar = require('../Assets/images/brands/jaguar.png')395const benz = require('../Assets/images/brands/benz.png')396const mini = require('../Assets/images/brands/mini.png')397const range = require('../Assets/images/brands/rangerover.png')...

Full Screen

Full Screen

CarInfoScreen.js

Source:CarInfoScreen.js Github

copy

Full Screen

1import React from 'react'2import { View, Text, ImageBackground, Image } from 'react-native'3import { responsiveHeight } from 'react-native-responsive-dimensions';4import Header from '../Components/Header';5import NativeButton from '../Components/NativeButton';6import { almostBlack, backgroundColor, grey, primaryColor, translucentBlack, white } from '../Theme/colors'7import { PoppinsBold, PoppinsMedium, PoppinsRegular, PoppinsSemiBold } from '../Theme/fonts';8export default function CarInfoScreen({9 navigation,10 route11}) {12 const {13 car,14 image,15 brandImage,16 location,17 startDate,18 startTime,19 dropDate,20 dropTime21 } = route.params;22 return (23 <View style={{24 flex: 1,25 backgroundColor: backgroundColor26 }}>27 <Header28 title='Car Details'29 leftButton={require('../Assets/images/back.png')}30 leftButtonOnPress={() => navigation.goBack()}31 />32 <ImageBackground33 style={{34 flex: 1,35 justifyContent: 'center'36 }}37 source={image}38 >39 <View style={{40 position: 'absolute',41 left: 60,42 width: responsiveHeight(50),43 backgroundColor: white,44 borderRadius: 10,45 borderTopColor: primaryColor,46 borderTopWidth: 1047 }}>48 <View style={{49 flexDirection: 'row',50 alignItems: 'center',51 justifyContent: 'space-between',52 padding: 1053 }}>54 <Text style={{55 fontFamily: PoppinsMedium,56 color: almostBlack,57 fontSize: 24,58 textTransform: 'capitalize',59 }}>60 {car.name}61 </Text>62 <Image63 source={brandImage}64 resizeMode='contain'65 style={{66 width: 60,67 height: 6068 }}69 />70 </View>71 <View style={{72 flexDirection: 'row',73 alignItems: 'center',74 justifyContent: 'space-between',75 marginBottom: 5,76 borderBottomColor: backgroundColor,77 borderBottomWidth: 2,78 marginHorizontal: 1079 }}>80 <Text style={{81 fontFamily: PoppinsRegular,82 color: almostBlack,83 fontSize: 18,84 textTransform: 'capitalize',85 padding: 1086 }}>87 Seats88 </Text>89 <Text style={{90 fontFamily: PoppinsRegular,91 color: almostBlack,92 fontSize: 18,93 textTransform: 'capitalize',94 padding: 1095 }}>96 {car.capcity}97 </Text>98 </View>99 <View style={{100 flexDirection: 'row',101 alignItems: 'center',102 justifyContent: 'space-between',103 marginBottom: 5,104 borderBottomColor: backgroundColor,105 borderBottomWidth: 2,106 marginHorizontal: 10107 }}>108 <Text style={{109 fontFamily: PoppinsRegular,110 color: almostBlack,111 fontSize: 18,112 textTransform: 'capitalize',113 padding: 10114 }}>115 Fuel Type116 </Text>117 <Text style={{118 fontFamily: PoppinsRegular,119 color: almostBlack,120 fontSize: 18,121 textTransform: 'capitalize',122 padding: 10123 }}>124 {car.class === 0 ? 'Petrol' : 'Diesel'}125 </Text>126 </View>127 <View style={{128 flexDirection: 'row',129 alignItems: 'center',130 justifyContent: 'space-between',131 marginBottom: 5,132 borderBottomColor: backgroundColor,133 borderBottomWidth: 2,134 marginHorizontal: 10135 }}>136 <Text style={{137 fontFamily: PoppinsRegular,138 color: almostBlack,139 fontSize: 18,140 textTransform: 'capitalize',141 padding: 10142 }}>143 Transmission144 </Text>145 <Text style={{146 fontFamily: PoppinsRegular,147 color: almostBlack,148 fontSize: 18,149 textTransform: 'capitalize',150 padding: 10151 }}>152 {car.transmission === 0 ? 'Auto' : 'Manual'}153 </Text>154 </View>155 <View style={{156 flexDirection: 'row',157 alignItems: 'center',158 justifyContent: 'space-between',159 marginBottom: 5,160 borderBottomColor: backgroundColor,161 borderBottomWidth: 2,162 marginHorizontal: 10163 }}>164 <Text style={{165 fontFamily: PoppinsRegular,166 color: almostBlack,167 fontSize: 18,168 textTransform: 'capitalize',169 padding: 10170 }}>171 Class172 </Text>173 <Text style={{174 fontFamily: PoppinsRegular,175 color: almostBlack,176 fontSize: 18,177 textTransform: 'uppercase',178 padding: 10179 }}>180 {car.type}181 </Text>182 </View>183 <View style={{184 flexDirection: 'row',185 alignItems: 'center',186 justifyContent: 'space-between',187 marginBottom: 5,188 borderBottomColor: backgroundColor,189 borderBottomWidth: 2,190 marginHorizontal: 10191 }}>192 <Text style={{193 fontFamily: PoppinsRegular,194 color: almostBlack,195 fontSize: 18,196 textTransform: 'capitalize',197 padding: 10198 }}>199 Rent Type200 </Text>201 <Text style={{202 fontFamily: PoppinsRegular,203 color: almostBlack,204 fontSize: 18,205 textTransform: 'capitalize',206 padding: 10207 }}>208 {car.withdriver ? 'Driver' : 'Self'}209 </Text>210 </View>211 <NativeButton212 onPress={() => navigation.navigate('Book', {213 car: car,214 location,215 startDate,216 startTime,217 dropDate,218 dropTime219 })}220 title='Rent Now'221 buttonStyle={{222 padding: 5,223 backgroundColor: primaryColor,224 borderRadius: 5,225 justifyContent: 'center',226 alignItems: 'center',227 margin: 10228 }}229 textStyle={{230 fontFamily: PoppinsBold,231 fontSize: 20,232 color: white233 }}234 />235 </View>236 </ImageBackground>237 </View>238 )...

Full Screen

Full Screen

code.js

Source:code.js Github

copy

Full Screen

1document.addEventListener('DOMContentLoaded', () => {2 // ============== COLORS AND THEMES =============== //3 const colors = {4 white: '#FFFFFF',5 lightGray: '#F5F3F4',6 gray: '#D3D3D3',7 warmGray: '#B1A7A6',8 tomatoRed: '#E5383B',9 lightRed: '#BA181B',10 red: '#A4161A',11 darkRed: '#660708',12 darkGray: '#161A1D',13 almostBlack: '#0B090A'14 }15 let isLight = true;16 let isDark = false;17 let isRed = false;18 // =============== EXAMPLE ARTICLE INFO =============== //19 let headline = 'Hello World!';20 let subheadline = 'You can update your display preferences.';21 let author = 'This Guy';22 let publishDate = '6:45pm Wed March 17, 2021';23 let copy1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet risus feugiat in ante metus dictum at. Velit egestas dui id ornare arcu odio. Bibendum neque egestas congue quisque egestas. Gravida arcu ac tortor dignissim convallis aenean. Risus at ultrices mi tempus imperdiet nulla malesuada. Amet consectetur adipiscing elit duis. Quam pellentesque nec nam aliquam sem et. Pulvinar pellentesque habitant morbi tristique senectus et netus. Aliquam purus sit amet luctus venenatis. Malesuada pellentesque elit eget gravida cum sociis.';24 let copy2 = 'Mattis rhoncus urna neque viverra justo nec ultrices dui. At consectetur lorem donec massa sapien faucibus et molestie ac. Vitae purus faucibus ornare suspendisse sed nisi lacus sed viverra. Lectus magna fringilla urna porttitor. Tristique nulla aliquet enim tortor. Massa massa ultricies mi quis hendrerit dolor magna eget est. Commodo nulla facilisi nullam vehicula. Scelerisque viverra mauris in aliquam sem fringilla ut morbi. Tortor vitae purus faucibus ornare suspendisse sed nisi lacus. Ut porttitor leo a diam sollicitudin tempor id eu. Nulla facilisi nullam vehicula ipsum a arcu cursus vitae. Nulla malesuada pellentesque elit eget gravida cum sociis natoque penatibus. Curabitur gravida arcu ac tortor dignissim convallis. Scelerisque eu ultrices vitae auctor eu augue ut. Nunc mi ipsum faucibus vitae. Vivamus arcu felis bibendum ut. Ultrices vitae auctor eu augue ut lectus arcu.';25 // =============== ELEMENTS =============== //26 const body = document.body;27 const container = document.createElement('div');28 container.className = 'container';29 const header = document.createElement('header');30 const headerContent = document.createElement('div');31 headerContent.className = 'header-content';32 const logo = document.createElement('div');33 logo.className = 'logo';34 logo.textContent = '📚';35 logo.style.color = colors.tomatoRed;36 logo.style.border = `0.2rem solid ${colors.tomatoRed}`;37 const dropdown = document.createElement('div');38 dropdown.className = 'dropdown';39 const dropBtn = document.createElement('button');40 dropBtn.className = 'drop-btn';41 dropBtn.textContent = 'Preferences';42 const dropContent = document.createElement('div');43 dropContent.className = 'drop-content';44 45 const light = document.createElement('a');46 light.textContent = 'Light Mode';47 light.href = '#';48 light.addEventListener('click', () => {49 isLight = true;50 [isDark, isRed] = [false, false];51 renderTheme();52 });53 54 const dark = document.createElement('a');55 dark.textContent = 'Dark Mode';56 dark.href = '#';57 dark.addEventListener('click', () => {58 isDark = true;59 [isLight, isRed] = [false, false];60 renderTheme();61 });62 const red = document.createElement('a');63 red.textContent = 'Red Mode';64 red.href = '#';65 red.addEventListener('click', () => {66 isRed = true;67 [isLight, isDark] = [false, false];68 renderTheme();69 });70 const main = document.createElement('main');71 const h1 = document.createElement('h1');72 h1.textContent = headline;73 h1.style.marginTop = '3rem';74 const h3 = document.createElement('h3');75 h3.textContent = subheadline;76 const details = document.createElement('p');77 details.textContent = `${publishDate} | Written by ${author}`;78 details.style.fontSize = '0.9rem';79 const p1 = document.createElement('p');80 p1.textContent = copy1;81 p1.style.lineHeight = '1.8rem';82 const p2 = document.createElement('p');83 p2.textContent = copy2;84 p2.style.lineHeight = '1.8rem';85 // =============== Functions =============== //86 function applyLight() {87 body.style.backgroundColor = colors.lightGray;88 header.style.backgroundColor = colors.lightGray;89 dropBtn.style.color = colors.darkGray;90 dropBtn.style.border = `0.1rem solid ${colors.darkGray}`;91 dropContent.style.backgroundColor = colors.lightGray;92 dropContent.style.border = `0.1rem solid ${colors.darkGray}`;93 light.style.color = colors.almostBlack;94 dark.style.color = colors.almostBlack;95 red.style.color = colors.almostBlack;96 main.style.backgroundColor = colors.white;97 h1.style.color = colors.darkGray;98 h3.style.color = colors.darkGray;99 details.style.color = colors.warmGray;100 p1.style.color = colors.darkGray;101 p2.style.color = colors.darkGray;102 }103 function applyDark() {104 body.style.backgroundColor = colors.almostBlack;105 header.style.backgroundColor = colors.almostBlack;106 dropBtn.style.color = colors.lightGray;107 dropBtn.style.border = `0.1rem solid ${colors.lightGray}`;108 dropContent.style.backgroundColor = colors.almostBlack;109 dropContent.style.border = `0.1rem solid ${colors.lightGray}`;110 light.style.color = colors.white;111 dark.style.color = colors.white;112 red.style.color = colors.white;113 main.style.backgroundColor = colors.darkGray;114 h1.style.color = colors.gray;115 h3.style.color = colors.gray;116 details.style.color = colors.warmGray;117 p1.style.color = colors.gray;118 p2.style.color = colors.gray;119 }120 function applyRed() {121 body.style.backgroundColor = colors.red;122 header.style.backgroundColor = colors.red;123 dropBtn.style.color = colors.tomatoRed;124 dropBtn.style.border = `0.1rem solid ${colors.tomatoRed}`;125 dropContent.style.backgroundColor = colors.red;126 dropContent.style.border = `0.1rem solid ${colors.tomatoRed}`;127 light.style.color = colors.tomatoRed;128 dark.style.color = colors.tomatoRed;129 red.style.color = colors.tomatoRed;130 main.style.backgroundColor = colors.darkRed;131 h1.style.color = colors.tomatoRed;132 h3.style.color = colors.tomatoRed;133 details.style.color = colors.lightRed;134 p1.style.color = colors.tomatoRed;135 p2.style.color = colors.tomatoRed;136 }137 function renderTheme() {138 if (isLight === true) {139 light.textContent = 'Light Mode ✓';140 applyLight();141 } else {142 light.textContent = 'Light Mode';143 }144 if (isDark === true) {145 dark.textContent = 'Dark Mode ✓';146 applyDark();147 } else {148 dark.textContent = 'Dark Mode';149 }150 if (isRed === true) {151 red.textContent = 'Red Mode ✓';152 applyRed();153 } else {154 red.textContent = 'Red Mode';155 }156 }157 function addContent() {158 body.appendChild(container);159 container.appendChild(header);160 container.appendChild(main);161 header.appendChild(headerContent);162 headerContent.appendChild(logo);163 headerContent.appendChild(dropdown);164 dropdown.appendChild(dropBtn);165 dropdown.appendChild(dropContent);166 dropContent.appendChild(light);167 dropContent.appendChild(dark);168 dropContent.appendChild(red);169 main.appendChild(h1);170 main.appendChild(h3);171 main.appendChild(details);172 main.appendChild(p1);173 main.appendChild(p2);174 }175 176 addContent();177 renderTheme();...

Full Screen

Full Screen

theme.js

Source:theme.js Github

copy

Full Screen

1// @flow2import { darken, lighten } from "polished";3const colors = {4 almostBlack: "#111319",5 lightBlack: "#2F3336",6 almostWhite: "#E6E6E6",7 veryDarkBlue: "#08090C",8 slate: "#9BA6B2",9 slateLight: "#DAE1E9",10 slateDark: "#4E5C6E",11 smoke: "#F4F7FA",12 smokeLight: "#F9FBFC",13 smokeDark: "#E8EBED",14 white: "#FFF",15 white10: "rgba(255, 255, 255, 0.1)",16 white50: "rgba(255, 255, 255, 0.5)",17 black: "#000",18 black05: "rgba(0, 0, 0, 0.05)",19 black10: "rgba(0, 0, 0, 0.1)",20 black50: "rgba(0, 0, 0, 0.50)",21 primary: "#0366d6",22 yellow: "#FBCA04",23 warmGrey: "#EDF2F7",24 danger: "#D0021B",25 warning: "#f08a24",26 success: "#2f3336",27 info: "#a0d3e8",28};29const spacing = {30 padding: "1.5vw 1.875vw",31 vpadding: "1.5vw",32 hpadding: "1.875vw",33 sidebarWidth: "280px",34 sidebarMinWidth: "250px",35 sidebarMaxWidth: "350px",36};37export const base = {38 ...colors,39 ...spacing,40 fontFamily:41 "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen, Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif",42 fontFamilyMono:43 "'SFMono-Regular',Consolas,'Liberation Mono', Menlo, Courier,monospace",44 fontWeight: 400,45 backgroundTransition: "background 100ms ease-in-out",46 zIndex: 100,47 selected: colors.primary,48 buttonBackground: colors.primary,49 buttonText: colors.white,50 textHighlight: "#B3E7FF",51 codeComment: "#6a737d",52 codePunctuation: "#5e6687",53 codeNumber: "#d73a49",54 codeProperty: "#c08b30",55 codeTag: "#3d8fd1",56 codeString: "#032f62",57 codeSelector: "#6679cc",58 codeAttr: "#c76b29",59 codeEntity: "#22a2c9",60 codeKeyword: "#d73a49",61 codeFunction: "#6f42c1",62 codeStatement: "#22a2c9",63 codePlaceholder: "#3d8fd1",64 codeInserted: "#202746",65 codeImportant: "#c94922",66 blockToolbarBackground: colors.white,67 blockToolbarTrigger: colors.slate,68 blockToolbarTriggerIcon: colors.white,69 blockToolbarItem: colors.almostBlack,70 blockToolbarText: colors.almostBlack,71 blockToolbarHoverBackground: colors.slateLight,72 blockToolbarDivider: colors.slateLight,73 breakpoints: {74 mobile: 0, // targeting all devices75 tablet: 737, // targeting devices that are larger than the iPhone 6 Plus (which is 736px in landscape mode)76 desktop: 1025, // targeting devices that are larger than the iPad (which is 1024px in landscape mode)77 desktopLarge: 1600,78 },79};80export const light = {81 ...base,82 background: colors.white,83 secondaryBackground: colors.warmGrey,84 link: colors.almostBlack,85 text: colors.almostBlack,86 textSecondary: colors.slateDark,87 textTertiary: colors.slate,88 placeholder: "#B1BECC",89 sidebarBackground: colors.warmGrey,90 sidebarItemBackground: colors.black10,91 sidebarText: "rgb(78, 92, 110)",92 shadow: "rgba(0, 0, 0, 0.2)",93 menuBackground: colors.white,94 menuShadow:95 "0 0 0 1px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.08)",96 divider: colors.slateLight,97 inputBorder: colors.slateLight,98 inputBorderFocused: colors.slate,99 listItemHoverBackground: colors.warmGrey,100 toolbarBackground: colors.lightBlack,101 toolbarInput: colors.white10,102 toolbarItem: colors.white,103 tableDivider: colors.smokeDark,104 tableSelected: colors.primary,105 tableSelectedBackground: "#E5F7FF",106 buttonNeutralBackground: colors.white,107 buttonNeutralText: colors.almostBlack,108 buttonNeutralBorder: darken(0.15, colors.white),109 tooltipBackground: colors.almostBlack,110 tooltipText: colors.white,111 toastBackground: colors.almostBlack,112 toastText: colors.white,113 quote: colors.slateLight,114 codeBackground: colors.smoke,115 codeBorder: colors.smokeDark,116 embedBorder: "#DDD #DDD #CCC",117 horizontalRule: colors.smokeDark,118};119export const dark = {120 ...base,121 background: colors.almostBlack,122 secondaryBackground: colors.black50,123 link: colors.almostWhite,124 text: colors.almostWhite,125 textSecondary: lighten(0.1, colors.slate),126 textTertiary: colors.slate,127 placeholder: colors.slateDark,128 sidebarBackground: colors.veryDarkBlue,129 sidebarItemBackground: colors.veryDarkBlue,130 sidebarText: colors.slate,131 shadow: "rgba(0, 0, 0, 0.6)",132 menuBorder: lighten(0.1, colors.almostBlack),133 menuBackground: lighten(0.015, colors.almostBlack),134 menuShadow:135 "0 0 0 1px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.08), inset 0 0 1px rgba(255,255,255,.2)",136 divider: darken(0.2, colors.slate),137 inputBorder: colors.slateDark,138 inputBorderFocused: colors.slate,139 listItemHoverBackground: colors.black50,140 toolbarBackground: colors.white,141 toolbarInput: colors.black10,142 toolbarItem: colors.lightBlack,143 tableDivider: colors.lightBlack,144 tableSelected: colors.primary,145 tableSelectedBackground: "#002333",146 buttonNeutralBackground: colors.almostBlack,147 buttonNeutralText: colors.white,148 buttonNeutralBorder: colors.slateDark,149 tooltipBackground: colors.white,150 tooltipText: colors.lightBlack,151 toastBackground: colors.white,152 toastText: colors.lightBlack,153 quote: colors.almostWhite,154 codeBackground: colors.black,155 codeBorder: colors.black50,156 codeString: "#3d8fd1",157 embedBorder: colors.black50,158 horizontalRule: darken(0.2, colors.slate),159};...

Full Screen

Full Screen

SideBar.js

Source:SideBar.js Github

copy

Full Screen

1// import {colors} from "../util/colors"2import { css } from '@emotion/core';3// import Link from 'next/link';4import React, { useState } from 'react';5import { colors } from '../util/colors';6// import Link from 'next/link';7import RenderIng from './RenderIng';8import Autocomplete from './Autocomplete';9const sidebar = css`10 position: fixed;11 background-color: ${colors.almostwhite};12 left: 0;13 top: -1px;14 height: 100%;15 overflow-y: auto;16 width: 350px;17 box-shadow: -18px 0px 15px 10px rgba(0, 0, 0, 0.39);18 margin-right: 350px;19 padding: 0 0 50px 0;20 display: flex;21 flex-direction: column;22 @media (max-width: 800px) {23 position: relative;24 height: 458px;25 width: 100%;26 align-items: center;27 overflow-y: visible;28 box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.09);29 height img {30 margin: 0;31 width: 500px;32 }33 }34 img {35 width: 250px;36 margin: 0 0 0 50px;37 border-radius: 0 0 10px 10px;38 @media (max-width: 800px) {39 margin: 0 0 -50px 0;40 width: 300px;41 }42 }43 form {44 display: flex;45 margin: 76px 0 30px 0;46 @media (max-width: 800px) {47 margin: 74px 0 30px 0;48 }49 }50 input[type='text'] {51 border: none;52 border-radius: 10px 0 0 10px;53 font-family: 'Lato';54 box-shadow: 9px 9px 16px rgb(163, 177, 198, 0.6),55 -9px -9px 16px rgba(255, 255, 255, 0.5);56 outline: 0;57 padding: 15px 10px;58 margin: 0 0 0 20px;59 width: 250px;60 background-color: ${colors.almostwhite};61 @media (max-width: 800px) {62 margin: 0;63 }64 :focus {65 background-color: ${colors.lightorange};66 color: ${colors.almostblack};67 ::placeholder {68 color: transparent;69 }70 }71 ::-webkit-input-placeholder {72 color: ${colors.almostblack};73 font-family: Lato;74 font-weight: bold;75 letter-spacing: 0.1rem;76 word-spacing: 0.15rem;77 }78 ::-moz-placeholder {79 color: ${colors.almostblack};80 color: ${colors.almostblack};81 font-family: Lato;82 font-weight: bold;83 letter-spacing: 0.1rem;84 word-spacing: 0.15rem;85 }86 :-ms-input-placeholder {87 color: ${colors.almostblack};88 color: ${colors.almostblack};89 font-family: Lato;90 font-weight: bold;91 letter-spacing: 0.1rem;92 word-spacing: 0.15rem;93 }94 :-moz-placeholder {95 color: ${colors.almostblack};96 color: ${colors.almostblack};97 font-family: Lato;98 font-weight: bold;99 letter-spacing: 0.1rem;100 word-spacing: 0.15rem;101 }102 }103 input[type='submit'] {104 border: none;105 border-radius: 0 15px 15px 0px;106 padding: 0 15px;107 color: ${colors.almostwhite};108 background-color: ${colors.darkorange};109 box-shadow: 9px 9px 16px rgb(163, 177, 198, 0.6);110 transition-timing-function: ease-out;111 transition: 0.2s;112 :hover {113 background-color: ${colors.orange};114 transform: translate(0, 1px);115 }116 }117 .renderItems {118 display: flex;119 max-width: 350px;120 flex-direction: row;121 flex-wrap: wrap;122 }123 .positionfixed {124 position: sticky;125 }126`;127//##############################################################################################################//128let number = 0;129export default function Sidebar(props) {130 const [newUserIng, setNewUserIng] = useState('');131 const [suggestions, setSuggestions] = useState([]);132 function handleSubmit(e) {133 e.preventDefault();134 props.setUserIngArray([135 ...props.userIngArray,136 { ing: newUserIng, id: number++ },137 ]);138 setNewUserIng('');139 }140 return (141 <div css={sidebar}>142 <img src="logo.svg" alt="Logo" />143 <div className="positionfixed">144 <form onSubmit={handleSubmit}>145 <Autocomplete146 input={newUserIng}147 setInput={setNewUserIng}148 suggestions={suggestions}149 setSuggestions={setSuggestions}150 ingArray={props.dbMainIngArray}151 top={'122px'}152 left={'31px'}153 />154 <input type="submit" value="ADD" />155 </form>156 <div className="renderItems">157 <RenderIng158 userIngArray={props.userIngArray}159 setUserIngArray={props.setUserIngArray}160 />161 </div>162 </div>163 </div>164 );...

Full Screen

Full Screen

styles.js

Source:styles.js Github

copy

Full Screen

1import facepaint from 'facepaint';2export const almostBlack = '#363637';3export const red = '#FC1051';4export const lightGray = '#E3E4E6';5export const white = '#FFF';6export const black = '#000';7export const mq = facepaint([8 '@media(min-width: 768px)',9 '@media(min-width: 0)',10]);11export const center = {12 position: 'absolute',13 left: '50%',14 top:' 50%',15 transform: 'translate(-50%, -50%)',16};17export const row = props => ({18 marginTop: props.showNotes || props.isAnswer ? 86 : 50,19 height: props.showNotes || props.isAnswer ? 'calc(100vh - 146px)' : 'calc(100vh - 110px)',20 textAlign: 'center',21 overflow: 'auto',22});23export const artboard = mq({24 height: 'calc(100vh - 200px)',25 margin: '0 auto 40px',26 width: ['100%', 450],27});28export const nav = {29 position: 'fixed',30 top: 0,31 width: '100%',32};33export const bar = {34 background: red,35 height: 30,36};37export const header = {38 background: lightGray,39 boxShadow: '0 3px 3px 0 rgba(0,0,0,0.14), 0 1px 7px 0 rgba(0,0,0,0.12), 0 3px 1px -1px rgba(0,0,0,0.2)',40 color: almostBlack,41 textAlign: 'center',42 margin: 0,43 paddingBottom: 10,44 paddingTop: 10,45};46export const buttonWrapper = {47 textAlign: 'center',48 position: 'fixed',49 width: '100%',50 bottom: 0,51};52export const button = props => ({53 background: props.gradient === 'light' ? lightGray : red,54 border: 'none',55 borderRadius: typeof props.borderRadius !== 'undefined' ? props.borderRadius : 4,56 boxShadow: props.boxShadowUpwards ? '0 -3px 3px 0 rgba(0,0,0,0.14), 0 1px 7px 0 rgba(0,0,0,0.12), 0 -3px 1px -1px rgba(0,0,0,0.2)' : '0 3px 3px 0 rgba(0,0,0,0.14), 0 1px 7px 0 rgba(0,0,0,0.12), 0 3px 1px -1px rgba(0,0,0,0.2)',57 color: props.gradient === 'light' ? almostBlack : white,58 cursor: 'pointer',59 fontFamily: 'inherit',60 fontSize: '1.3rem',61 fontWeight: props.gradient === 'light' ? 600 : 'normal',62 height: 60,63 letterSpacing: 2,64 textTransform: 'uppercase',65 verticalAlign: 'top',66 width: props.width ? props.width : '100%',...

Full Screen

Full Screen

typography.js

Source:typography.js Github

copy

Full Screen

1import styled from 'styled-components'2import { colors } from './colors'3export const H1 = styled.div`4 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';5 font-weight: 500;6 font-size: 34px;7 line-height: 34px;8 color: ${colors.almostBlack};9 font-style: normal;10 margin: 20px 0;11 // letter-spacing: 0.05em;12`13export const H2 = styled.div`14 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';15 font-weight: 500;16 font-size: 28px;17 line-height: 36px;18 margin: 20px 0;19 color: ${colors.almostBlack};20`21export const H3 = styled.div`22 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';23 font-weight: 600;24 font-size: 16px;25 color: ${({ color }) => color || colors.almostBlack};26`27export const Regular = styled.div`28 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';29 font-weight: 400;30 font-size: 1.2em;31 // line-height: 24px;32 color: ${colors.almostBlack};33`34export const Prompt = styled.div`35 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';36 font-weight: 500;37 font-size: 20px;38 line-height: 24px;39 color: ${colors.almostBlack};40 margin: 30px 10px;41 max-width: 700px;42 @media (max-width: 450px) {43 font-size: 16px;44 margin: 10px 0;45 }46`47export const Subtitle = styled.div`48 font-family: 'Manrope', 'Helvetica Neue', Roboto, 'Segoe WP', 'Segoe UI';49 font-weight: 400;50 font-size: 14px;51 line-height: 21px;52 color: ${({ color }) => color || colors.mediumGray};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `example.png` });7 await page.evaluate(() => {8 window.playwright.almostBlack();9 });10 await page.screenshot({ path: `example-almost-black.png` });11 await browser.close();12})();13### `page.almostBlack()`14[Apache 2.0](LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const color = await page.evaluate(() => {7 return window.getComputedStyle(document.body).backgroundColor;8 });9 console.log(color);10 await browser.close();11})();12const {chromium} = require('playwright');13(async () => {14 const browser = await chromium.launch();15 const context = await browser.newContext({16 });17 const page = await context.newPage();18 const color = await page.evaluate(() => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.almostBlack();7 await page.screenshot({ path: `screenshot.png` });8 await browser.close();9})();10### almostBlack(options?: { threshold?: number, contrast?: number, brightness?: number, saturation?: number, grayscale?: number })11[MIT](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.waitForSelector('.navbar__inner');7 await page.almostBlack('.navbar__inner');8 await page.screenshot({ path: `navbar.png` });9 await browser.close();10})();11#### page.almostBlack(selector[, options])12 - `threshold` <[number]>: A number between 0 and 1 indicating the maximum allowed difference between the color of the pixel and black. Defaults to 0.05. See [pixelmatch](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const almostBlack = await page.evaluate(async () => {7 const { almostBlack } = require('playwright/internal');8 return almostBlack('rgb(255, 0, 0)');9 });10 await browser.close();11})();12### `isDark(color)`13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch();16 const context = await browser.newContext();17 const page = await context.newPage();18 const isDark = await page.evaluate(async () => {19 const { isDark } = require('playwright/internal');20 return isDark('rgb(255, 0, 0)');21 });22 await browser.close();23})();24### `isLight(color)`25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 const isLight = await page.evaluate(async () => {31 const { isLight } = require('playwright/internal');32 return isLight('rgb(255, 0, 0)');33 });34 await browser.close();35})();36### `isTransparent(color)`37const { chromium } = require('playwright');38(async () => {39 const browser = await chromium.launch();40 const context = await browser.newContext();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { webkit, devices } = require('playwright-internal');2const iPhone = devices['iPhone 6'];3(async () => {4 const browser = await webkit.launch({ headless: false });5 const context = await browser.newContext({6 recordVideo: { dir: 'videos/' },7 });8 const page = await context.newPage();9 await page.type('#searchInput', 'Black Lives Matter');10 await page.click('text="English"');11 await page.click('text="Go"');12 await page.waitForSelector('text="Black Lives Matter"');13 await page.click('text="Black Lives Matter"');14 await page.waitForSelector('text="Black Lives Matter"');15 await page.click('text="Black Lives Matter"');16 await page.waitForSelector('text="Black Lives Matter"');17 await page.click('text="Black Lives Matter"');18 await page.waitForSelector('text="Black Lives Matter"');19 await page.click('text="Black Lives Matter"');20 await page.waitForSelector('text="Black Lives Matter"');21 await page.click('text="Black Lives Matter"');22 await page.waitForSelector('text="Black Lives Matter"');23 await page.click('text="Black Lives Matter"');24 await page.waitForSelector('text="Black Lives Matter"');25 await page.click('text="Black Lives Matter"');26 await page.waitForSelector('text="Black Lives Matter"');27 await page.click('text="Black Lives Matter"');28 await page.waitForSelector('text="Black Lives Matter"');29 await page.click('text="Black Lives Matter"');30 await page.screenshot({ path: `test.png` });31 await browser.close();32})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: `screenshot.png` });6 await browser.close();7})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { almostBlack } = require('playwright/lib/server/supplements/recorder/recorderSupplement');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.screenshot({ path: `example.png`, fullPage: true });7 await browser.close();8})();9Contributions are welcome! Please refer to the [contributing guide](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const color = await page.evaluate(() => {6 return getComputedStyle(document.querySelector('header')).color;7 });8 console.log(await page._client.send('Playwright.almostBlack', { color }));9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { almostBlack } = require('playwright/lib/server/chromium/crPage');2const { almostBlack } = require('playwright/lib/server/chromium/crPage');3describe('Test', () => {4 it('should work', async () => {5 const browser = await chromium.launch({ headless: false, slowMo: 1000 });6 const page = await browser.newPage();7 await page.setViewportSize({ width: 1280, height: 800 });8 const screenshot = await page.screenshot();9 const almostBlackPixels = await almostBlack(screenshot);10 console.log(almostBlackPixels);11 await browser.close();12 });13});14### almostBlack(screenshot)

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful