Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Style your Co mponents wit h styled-comp onents! ©amagitakayosi
Slide 2
Slide 2 text
@amagitakayosi
Slide 3
Slide 3 text
Έͳ͞Μ CSS Ͳ͏ͯ͠·͔͢ʁ
Slide 4
Slide 4 text
CSS in JS ͬͯ·͔͢ʁ
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
CSS in JS • ίϯϙʔωϯτͷελΠϧΛCSSͰͳ͘ JSͷΦϒδΣΫτͱͯ͠هड़͢Δ • είʔϓΛͰ͖Δʂ • ܧঝͰ͖Δʂ (Object.assignͳͲ)
Slide 7
Slide 7 text
ओͳCSS in JSϥΠϒϥϦ
Slide 8
Slide 8 text
ओͳCSS in JSϥΠϒϥϦ • Radium • Aphrodite • CSS Modules
Slide 9
Slide 9 text
FormidableLabs/radium • Reactͷhocͱ࣮ͯ͠ • JSΦϒδΣΫτΛstyleଐੑʹಥͬࠐΉ • renderϝιουΛΦʔόʔϥΠυͯ͠ ྑ͍ײ͡ʹͬͯ͘ΕΔ
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
FormidableLabs/radium
Slide 12
Slide 12 text
radiumͷࠔΓͲ͜Ζ • ٙࣅཁૉ͑ͳ͍ (:beforeͱ͔) • keyframeΞχϝʔγϣϯ͕ͪΐͬͱେม • :hover ʹελΠϧ͕͍ͭͯͨΒ onMouseOverͰٖࣅతʹ࣮ݱͯͯ͠େม
Slide 13
Slide 13 text
Khan/aphrodite • ΦϒδΣΫτΛ͢ͱɺͱରԠ͢Δ ҰҙͳΫϥε໊Λੜͯ͘͠ΕΔ • ٙࣅཁૉʹରԠ
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
AphroditeͷࠔΓͲ͜Ζ • σϑΥϧτͰ !important ͕͘ • ελΠϧΛωετͰ͖ͳ͍ ( .foo .bar {} ͱ͔ ) • globalͳελΠϧΛఆٛͰ͖ͳ͍
Slide 17
Slide 17 text
css-modules/css-modules • Webpackͷcss-loaderΛͬͯ CSSϑΝΠϧΛJSʹ import ͢Δ • ैདྷͲ͓Γͷํ๏Ͱ CSSSCSSͳͲΛهड़Ͱ͖Δ
Slide 18
Slide 18 text
+
Slide 19
Slide 19 text
CSS ModulesͷࠔΓͲ͜Ζ • શʹWebpackґଘ……
Slide 20
Slide 20 text
zeit/styled-jsx • babelͷϓϥάΠϯͱͯ͠ಈ࡞͢Δ • λάʹελΠϧΛهड़͢Δ
Slide 21
Slide 21 text
↓
Slide 22
Slide 22 text
styled-jsxͷࠔΓͲ͜Ζ • ʢݸਓతʹʣಡΈͮΒ͍…… • ͲͷཁૉʹͲͷελΠϧ͕ͨΔͷɺͱ͔ • media queryରԠ͕ඍົ
Slide 23
Slide 23 text
zeit/styled-jsx • ͦΜͳ
Slide 24
Slide 24 text
styled-components
Slide 25
Slide 25 text
styled-components • ελΠϧΛͯͨίϯϙʔωϯτΛ࡞Γɺ Έ߹ΘͤͯϨΠΞτ͢Δɺͱ͍͏ߟ͑ํ • Tagged Template Literalʹ CSSจࣈྻΛͦͷ··ॻ͚Δʂ
Slide 26
Slide 26 text
styled-componentsͷ͕͜͜خ͍͠ • CSSจࣈྻΛͦͷ··ॻ͚Δʂ • ؆୯ʹελΠϧΛܧঝͰ͖Δʂ • propsͰελΠϧΛมߋͰ͖Δʂ • React NativeରԠʂ
Slide 27
Slide 27 text
CSSจࣈྻΛͦͷ··ॻ͚Δ • Tagged Template Literalʹ CSSจࣈྻΛͦͷ··ॻ͘ • ‘:hover' : { fontSize: ‘1.6em’ } ͱ͔ ॻ͔ͣʹࡁΉ
Slide 28
Slide 28 text
؆୯ʹελΠϧΛܧঝͰ͖Δ
Slide 29
Slide 29 text
propsͰελΠϧΛมߋͰ͖Δ • ςʔϚมߋΈ͍ͨͳࣄͰ͖ͦ͏
Slide 30
Slide 30 text
React NativeରԠ • ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹͰ React NativeͷίϯϙʔωϯτΛ͑Δ • React NativeͷstyleCSSͱͪΐͬͱҧ͏͚Ͳ ྑ͍ײ͡ʹॻ͖͑ͯ͘ΕΔ
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
γϯλοΫεϋΠϥΠτ Ͳ͏͢Δʁ
Slide 33
Slide 33 text
γϯλοΫεϋΠϥΠτͲ͏͢Δʁ • Atom: language-babel • VSCode: vscode-styled-components • WebStorm: { /*language=CSS*/ }
Slide 34
Slide 34 text
Atomͷlanguage-babel • styled-componentsʹσϑΥϧτͰରԠ • ଞͷCSS in JSϥΠϒϥϦʹରԠͰ͖Δʁ ʢCSSϒϩοΫఆ͢Δਖ਼نදݱΛࣗͰఆٛͰ͖Δʣ
Slide 35
Slide 35 text
TypeScriptͩͱ……ʁ • atom-typescript ͱ language-babel ซ༻Ͱ͖ͳ͍ͬΆ͍ • vscode-styled-components ී௨ʹ͑Δ • ૉʹVSCode͏͔……ʢ◞‸◟ʣ • ͦΕͱ TSΊͯ flow ͏͔
Slide 36
Slide 36 text
࣮ࡍʹͬͯΈͨײ
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
ίϯϙʔωϯτͷཻ͕ࣗવͱখ͘͞ͳΔ • ελΠϧΛͯͨࢠίϯϙʔωϯτΛ ͨ͘͞Μఆٛ͢Δ͜ͱʹͳΔ • ଟ͘ͳΔͱࣗવͱϑΝΠϧׂͨ͘͠ͳΔ • ίϯϙʔωϯτ୯ҐͰߟ͑Δ͜ͱʹͳΔ • มͳநԽΛ͠ʹ͍͘
Slide 39
Slide 39 text
ͪΖΜ ࡶʹॻ͘͜ͱग़དྷΔ
Slide 40
Slide 40 text
$44͕ۤखͳਓʹͦ͜ Φεεϝʂ
Slide 41
Slide 41 text
styled-components ϑΝϛϦʔ
Slide 42
Slide 42 text
ؔ࿈ϥΠϒϥϦ͕͍ͭ͋͘Δ • polished • css-to-react-native • elm-styled
Slide 43
Slide 43 text
polished✨ • ศརؔηοτ • Sass࣌Ͱ͍͏compassΈ͍ͨͳΜ
Slide 44
Slide 44 text
css-to-react-native • CSSΛReactNativeͷstyleʹͤΔܗʹ มͯ͘͠ΕΔ • styled-componentsͷதͰΘΕͯΔ
Slide 45
Slide 45 text
elm-styled (ະϦϦʔε) • Elm༻ styled-components • ܕͷαϙʔτΛड͚ΒΕΔʂ
Slide 46
Slide 46 text
͓·͚: ܕ͖CSSγϦʔζ • Typestyle • TypeScriptʹΑΔνΣοΫΛ೦಄ʹஔ͍͍ͯΔ • ScalaCSS • ScalaͰελΠϧΛॻ͍ͯCSSΛग़ྗ͢Δ • Scala.js scalajs-reactͱซ༻͢Δͱ Scala͚ͩͰϑϩϯτΤϯυॻ͚Δ
Slide 47
Slide 47 text
ࢀߟ4DBMBKT4DBMB$44Ͱ༡Μͩهࣄ IUUQBNBHJUBLBZPTJIBUFOBCMPHDPNFOUSZ
Slide 48
Slide 48 text
·ͱΊ: ͜ΜͳਓʹΦεεϝ • CSS͕ۤखͳਓ • React NativeϢʔβʔ • աڈʹ CSS in JS ࢼ͚ͨ͠Ͳ ੑʹ߹Θͳ͔ͬͨਓ
Slide 49
Slide 49 text
ReactReactNative ΨϯΨϯ͍ͬͯ͜͏ͥʂʂ