? ????? ???? ???? ???? React ?? ????? ?? ?? ?? ??? ??? ??? ?????. ???? ???? ??, ?? ??? ?? ??, ?? ?? ??, ??? ??? ?? ?? ?? ?? ? ???? ???? ? ???? ???? ?? ?????. ???? ???? ?? ???? ?????.
?? ? ???? ?? ??? ??? ???? ???? ????? ? ??? ????. ? ????? ???? ????? ??? ?? ??? ???? React ?? ?? ?? ?? ??? ????? ?????.
???? ??
create-react-app
???? ??? React ????? ???? ??????.
NPX Create-React-App My-App CD My-App ?? ??
???? ???? ?? :
??? ???? ?? ??? ?????
?? ??? ?? theme.js
????.
// ?? .js ???? const lighttheme = { ?? : '#e2e2e2', ??? : '#363537', ?? ?? : '#fff', ????? : '?? ?? ( #39598a, #79d7ed)', }; ???? const darktheme = { ?? : '#363537', ??? : '#fafafa', ?? ?? : '#6B8096', ????? : '?? ???? ( #091236, #1e215d)', };
?? ?????? global.js
:
// global.js 'Styled-Components'?? {createglobalstyle} ?? ??; Const GlobalStyles = CreateGlobalstyle`? ?????? *, *:: After, *:: ?? {Box-Sizing : Border-Box; } ? { ?? ?? : ??; ?? : $ {({??}) => ??}; ?? : $ {({??}) => ?? .text}; ????? : Flex; ??? ?? : ?; ??? ??? : ??; ?? : 100VH; ?? : 0; ?? : 0; Font-Family : BlinkMacsystemFont, -Apple-System, 'Segoe UI', Roboto, Helvetica, Arial, Sans-Serif; ?? : ?? 0.25S ??; } `;;
App.js
??? :
// app.js 'React'?? React React; 'Styled-Components'?? {themeprovider} ?? ??; './theme'?? {lighttheme} ?? ??; './global'?? {globalstyles} ?? ??; ?? ? () { ?? ( <themeprovider theme="{lightTheme}"> <globalstyles></globalstyles> <h1>??? ?????!</h1> </themeprovider> ); } ?? ? ????;
?? ??
useState
?? ?? ? ?? ??? ?? ?? :
// app.js import React, {usestate} 'react'; // ... ?? ?? ?? ? () { const [??, setTheme] = usestate ( 'light'); const toggletheme = () => setTheme (?? === 'light'? 'dark': 'light'); const thememode = ?? === 'light'? Lighttheme : Darktheme; ?? ( <themeprovider theme="{themeMode}"> <globalstyles></globalstyles> <button onclick="{toggleTheme}">?? ??</button> <h1>{?? === 'light'???? 'Light': 'Dark'} ??!</h1> </themeprovider> ); }
GlobalStyles
?? ??? ???? ?????.
??? ??? ?? ?? ?? ??
Toggle.js
???? (????? ?? ????? Toggle.styled.js
) :
// toggle.js 'React'?? React React; 'prop-types'?? proptypes ?? ??; '???? ???'?? ???? ? ??; './icons/moon.svg'?? {reactComponent as Moonicon} import import; // SVG? ????? './icons/sun.svg'?? {ReactComponent as Sunicon} import import; const togglecontainer = Styled.button` / * ... ?? ??? ??? ... */ `;; const toggle = ({??, toggletheme}) => { const islight = ?? === '?'; ?? ( <togglecontainer lighttheme="{isLight}" onclick="{toggleTheme}"> <sunicon></sunicon> <moonicon></moonicon> </togglecontainer> ); }; toggle.proptypes = { ?? : proptypes.string.isrequired, TOGGLETHEME : proptypes.func.isrequired, }; ???? ?? ??;
Toggle
?? ??? ????? App.js
???????.
// app.js './toggle'?? ?? ?? ??; // ?? ?? ??? ????? // ... ?? ? ?? ... <toggle theme="{theme}" toggletheme="{toggleTheme}"></toggle>
?? ???? ?? SVG ??? ??? ???????.
useDarkMode
????? ???? ?? ??
useDarkMode.js
??????.
// usedarkMode.js 'react'?? {useeffect, usestate} import; const usedarkMode = () => {???? const [??, setTheme] = usestate (localStorage.getItem ( '??') || 'light'); const [componentMounted, setComponentMounted] = usestate (false); const setMode = (??) => { localStorage.setItem ( '??', ??); setTheme (??); }; const toggletheme = () => setMode (?? === 'light'? 'dark': 'light'); useeffect (() => { setComponentMounted (true); }, []); return [??, ?? ? ??, ?? ??]; };
??? ????? App.js
????????.
// app.js './usedarkmode'?? {usedarkmode} import; // ... ?? ? ?? ... const [??, toggletheme, componentmounted] = usedarkMode (); const thememode = ?? === 'light'? Lighttheme : Darktheme; if (! componentMounted) reto<div></div> ; // ??? ??? ???? ????? // ... ??? ?? ??? ...
?? ?? ??? ???? ?????.
???? ???? ? ??? ?? (?? ??)
???? OS ?? ??? ????? useDarkMode.js
??????.
// usedarkMode.js // ... ?? ?? ... useeffect (() => { const localtheme = localstorage.getItem ( '??'); const userprefersdark = window.matchmedia && wind if (localtheme) { setTheme (localtheme); } else if (userPrefersDark) { setMode ( 'Dark'); } ? ?? { setMode ( 'light'); } setComponentMounted (true); }, []); // ... ??? ?? ...
?? ?? ???? ??? ?? ?? ??? ??? prefers-color-scheme
??? ??? ?? ??? ?????. ?? ? ???? ?? ???? ???????. ? ?? ? ??? Dark Mode ??? ???????? ????? ???? ?? ??? ?????.
? ??? Dark Mode? React ? Temprovider? ?????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

CSS?? ????? ??? ? ?? ??? ????. 1. HTML ? CSS? ?? ??? ?????? ???? ?? ???? ?? ???? ??????. 2. ?? ??? ??? ?? ???? ???? ?? ?? ??? ?? ?? ??? ??????. 3. ??? ????? ???? JavaScript? ?? ???? ?????? ??? ?????. ? ?? ??? ??? ??? ????? ?? ??, ??, ??? ? ?? ???? ?? ?? ?? ??? ???? ?????.

CSS ???? ??? ? ??? ??? ????? ???? ??? ???? ???? ?? ?? ???? ????? ???????. 1. Flexbox ? ??? ??? ?? ???? ??? ??, ?? : ??? ?? ? ????? ??? ????. 2. Caniuse ?? ?? ?? ??? ??????. 3. -webkit-, -moz-, -ms-, -o- ? ?? ???? ???? ???? ?????. 4. AutoPrefixer? ???? ???? ???? ???? ?? ????. 5. ?? ????? ????? PostCSS? ???? BrowsersList? ??????. 6. ?? ? ???? ???? ?????. 7. Modernizr ?? ??? ??? ????? ??? ? ????. 8. ?? ????? ???? ?? ? ??? ????.

themaindifferencesbetweendisplay : ???, ??, andinline-blockinhtml/cssarelayoutbehavior, spaceusage ? stylingcontrol.1.inlineElementsFlowWithText, do n'tStartonnewlines, ingorewidth/height, andonlyapplyhorizontalpadding/margins —IdealforIneTeTexting

CSS? ?? ?? ??? ??? ??? ???? ???? SVG? ???? ?? ???, ?? ????, ??? ?? ?? ??? ?? ???? ??????. ??? ??? ????. 1. ?, ??, ??? ?? ?? ??? ?? ??? ?????. 2. ?? ?? ? ??? ???? ??? ? ????. 3. ?????? ?? ?? ?? ?? ????? ???? ?? ??? ?? ? ? ????. 4. ???? ???? ??? ??? ??? ????? ?? ? ??? ????. ???? ???? ?? ?? ?? : ? (50pxatcenter) ? ??? ?? ?? : ??? (50%0%, 100 0%, 0%)? ?? ????. ????

??? ?? ???? ???? ??? ??, ?? ??? ??? ? ? ????? ??? ??? ???? ???? ? ? ?? ? ? ????. 1. CSS ?? : ?? ??? ???? ???? ?? ??; 2. ????? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 3. ?? ??? ??? ??? ??? ?? ?? ???? ????????. 4. ??? ????? ??? ???? ?? ? ??? ??? ?? ??? ?? ?? ??? ????? ???? ?? ????.

CSS? ???? ?? ? ???? ???? ??? ?? ??? ?? ?? ?? ? ? ????. 1. Max width : 100% ? ?? : Auto? ???? ???? ??? ????? ???? ??? ??? ? ??????. 2. HTML? SRCSET ? ?? ??? ???? ?? ??? ??? ??? ??? ???????????. 3. ?? ?? ? ?? ??? ???? ??? ??? ? ?? ?????? ??????. ? ??? ?? ???? ?? ???? ???? ???? ????????.

?? ????? CSS ?? ??? ????? ?? ?? ??? ??, ?? ?? ?? ??, Flexbox ? ??? ???? ?? ?? ? ?? CSS ??? ????? ??? ???? ???? ?? ????? ??? ?????. 1. ?? ??? ??? ???? ????. ???? CSSRESET ?? NALLER.CSS? ???? ?? ???? ???? ????. 2. IE? ?? ??? ?? ?? ?? ??? ????. ?? ?? : ?? ? ???? ??? ??? ???? ?? ????. 3. Flexbox ? Grid? Edge Case ?? Old ???? ??? ?????. ? ?? ??? ? AutopRefixer ??; 4. ?? CSS ?? ??? ???? ????. Caniuse? ???? ?? ?????????.

CSS ??? ??? ?? ?? ?? ? ?? ? ?? ??? ?? ????. 1.px? ?? ??? ????? ?? ??? ??? ?? ??? ?????. 2.EM? ?? ????, ?? ?? ??? ??? ?? ?? ???? ??, REM? ?? ??? ???? ? ????? ??? ????? ?????. 3.VW/VH? ?? ? ???? ??? ??? ??? ??????? ?? ???? ?????? ???????. 4. ??? ?? ?? ? ??, ?? ?? ?? ? ??? ???? ???? ???????. ???? ??? ???? ??? ? ?? ??? ???? ? ????.
