Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kyotojs15_-_handy-media-query.pdf
Search
1natsu
January 12, 2019
Technology
1
1.1k
Kyotojs15_-_handy-media-query.pdf
Kyoto,js 15で話したスライドです
styled-componentsやemotionでメディアクエリをパッとやるという内容で喋りました
1natsu
January 12, 2019
Tweet
Share
More Decks by 1natsu
See All by 1natsu
ところでアジャイル開発のアジャイルってなんなんですか?
1natsu172
1
2.4k
文脈の多いこのご時世にユーザーフレンドリーなモジュールをnpm-publish - Kyoto.js16
1natsu172
1
280
AZUSA for Mac 2011を解説したスライド
1natsu172
0
5k
Other Decks in Technology
See All in Technology
いざ、BSC討伐の旅
nikinusu
2
780
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
220
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
Lambdaと地方とコミュニティ
miu_crescent
2
370
The Rise of LLMOps
asei
7
1.7k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
YesSQL, Process and Tooling at Scale
rocio
169
14k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
For a Future-Friendly Web
brad_frost
175
9.4k
Six Lessons from altMBA
skipperchong
27
3.5k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Being A Developer After 40
akosma
87
590k
Transcript
1natsu Θ͔ͬͨͨΊ͕͠ͳ͍ ࣗݾհ
1natsu Θ͔ͬͨͨΊ͕͠ͳ͍ υۓு ࣗݾհ
1natsu Θ͔ͬͨͨΊ͕͠ͳ͍ υۓு དྷͨͱ͖͓ෲݮͬͯͳ͔ͬͨΜͰ͢… ࣗݾհ
ແ 1natsu Θ͔ͬͨͨΊ͕͠ͳ͍ υۓு དྷͨͱ͖͓ෲݮͬͯͳ͔ͬͨΜͰ͢… ࣗݾհ
$44JO+4Ͱ ϝσΟΞΫΤϦΛ ύοͱΔ
TUZMFEDPNQPOFOUTͰ ϝσΟΞΫΤϦΛ ύοͱΔ
FNPUJPOͰ ϝσΟΞΫΤϦΛ ύοͱΔ
ಥવͰ͕͢
͜ͷͳ͔ʹ ϝσΟΞΫΤϦͷه๏͕ ύοͱग़Δ͓ํ ͍Βͬ͠Ό͍·͔͢ʁ
ग़Δͻͱ
εΰΠ
ग़ͳ͍ͻͱ
None
ReactͷίϯϙʔωϯτΛ ॻ͍͍ͯͨΜͰ͢Α ͋Δ
None
ϝσΟΞΫΤϦͷ ॻ͖͔ͨࣗମ͕ ύοͱΘ͔Βͳ͍
@media all and (max-width: 12450px) { … }
@media all and (max-width: 12450px) { … } ؙׅހͰғ͏
@media all and (max-width: 12450px) { … } ؙׅހͰғ͏ ϓϨϑΟοΫεmin-͔max-
@media all and (max-width: 12450px) { … } ؙׅހͰғ͏ ϓϨϑΟοΫεmin-͔max-
͜Ε͕media-feature
@media all and (max-width: 12450px) { … } ؙׅހͰғ͏ ϓϨϑΟοΫεmin-͔max-
͜Ε͕media-feature ίϩϯ
@media all and (max-width: 12450px) { … } ؙׅހͰғ͏ ϓϨϑΟοΫεmin-͔max-
͜Ε͕media-feature ίϩϯ ΫΦʔτͰғΘͳ͍
None
ͦͦ
ຖճॻ͘ͷݫ͍͠
୯Ґ͕͋ΔͷͰ emͰॻ͖͍ͨ https://zellwk.com/blog/media-query-units/
ϒϨʔΫϙΠϯτ ͍͍ܾͨͯ·ͬͯ͘ΔͷͰ ཧͱͯ͜͠͏ॻ͖͍ͨ
ίϯϙʔωϯτಠࣗͷ ΞϓϦέʔγϣϯͰ ڞ௨Ͱͳ͍ہॴతͳ ϝσΟΞΫΤϦ͕ग़͖ͯͨ
ͳΜ͔ ͏·͍͜ͱ ͳΒΜ͔ͳʙ
͋Δ͜ͱʹ͋Δ
TUZMFEDPNQPOFOUTͷυΩϡϝϯτͷྫ
ϒϨʔΫϙΠϯτఆٛ TUZMFEDPNQPOFOUTͷυΩϡϝϯτͷྫ
ϒϨʔΫϙΠϯτఆٛ TUZMFEDPNQPOFOUTͷυΩϡϝϯτͷྫ styled-componentsઐ༻ ϝσΟΞΫΤϦϥούʔͳ ΦϒδΣΫτΛ࡞
ϒϨʔΫϙΠϯτఆٛ TUZMFEDPNQPOFOUTͷυΩϡϝϯτͷྫ styled-componentsઐ༻ ϝσΟΞΫΤϦϥούʔͳ ΦϒδΣΫτΛ࡞ ͍ͬͯ͘ (ςϯϓϨʔτϦςϥϧ͕ ೖΕࢠʹͳΔ)
ϒϨʔΫϙΠϯτఆٛ TUZMFEDPNQPOFOUTͷυΩϡϝϯτͷྫ styled-componentsઐ༻ ϝσΟΞΫΤϦϥούʔͳ ΦϒδΣΫτΛ࡞ Αͦ͞͏Ͱ͋Δ͕…ઐ༻ ͍ͬͯ͘ (ςϯϓϨʔτϦςϥϧ͕ ೖΕࢠʹͳΔ)
FNPUJPOͷGBDFQBJOUΛ͏ྫ
ྻͰϒϨʔΫϙΠϯτ FNPUJPOͷGBDFQBJOUΛ͏ྫ
ϝσΟΞΫΤϦ࡞ ྻͰϒϨʔΫϙΠϯτ FNPUJPOͷGBDFQBJOUΛ͏ྫ
ϝσΟΞΫΤϦ࡞ ྻͰCSSΛॻ͘ ॱ൪ϝσΟΞΫΤϦॱ ྻͰϒϨʔΫϙΠϯτ FNPUJPOͷGBDFQBJOUΛ͏ྫ
ϝσΟΞΫΤϦ࡞ ྻͰCSSΛॻ͘ ॱ൪ϝσΟΞΫΤϦॱ ྻͰϒϨʔΫϙΠϯτ ύοͱΈͯΘ͔ΒΜ͘ͳ͍ʁ FNPUJPOͷGBDFQBJOUΛ͏ྫ
ͳΜ͔ ͏·͍͜ͱ ͳΒΜ͔ͳʙ
ͳΜ͔ ͏·͍͜ͱ ͳΒΜ͔ͳʙ ͦΜͳ͏·͍ͳ͍
͏·͍͜ͱ ͢Δ͔͠ͳ͍
yarn add @1natsu/handy-media-query
TypeScriptͰॻ͍͍ͯ·͢
None
Α͏͢ΔʹϝσΟΞΫΤϦ͘Μ
Φϓγϣϯ͋ΔΑ
None
͔͍͔ͭͨ
mediaQuery.js
mediaQuery.js ϝσΟΞΫΤϦ͘Μ
mediaQuery.js ϝσΟΞΫΤϦ͘Μ ϝσΟΞΫΤϦ ͓·ͱΊ͘Μ
mediaQuery.js ϝσΟΞΫΤϦ͘Μ ϝσΟΞΫΤϦ ͓·ͱΊ͘Μ px→emม͘Μ
mediaQuery.js
mediaQuery.js Α͘͏ϒϨʔΫϙΠϯτΛఆٛ (breakpoints.jsΈ͍ͨͳผϑΝΠϧʹΓग़ͯ͠OK)
mediaQuery.js
mediaQuery.js value͕’@media~’ͷΦϒδΣΫτΛ৯ΘͤΔ
mediaQuery.js খ͍͠ϝσΟΞΫΤϦఘΊͯॻ͘… value͕’@media~’ͷΦϒδΣΫτΛ৯ΘͤΔ
mediaQuery.js ໊͍લͰΤΫεϙʔτ͢Δͱศར
None
None
ఆٛͨ͠ϝσΟΞΫΤϦΦϒδΣΫτΛimport
ఆٛͨ͠ϝσΟΞΫΤϦΦϒδΣΫτΛimport ςϯϓϨʔτϦςϥϧͳͷͰ ఆ͓͍ٛͯͨ͠ϝσΟΞΫΤϦΛల։͢ΕOK
ఆٛͨ͠ϝσΟΞΫΤϦΦϒδΣΫτΛimport ςϯϓϨʔτϦςϥϧͳͷͰ ఆ͓͍ٛͯͨ͠ϝσΟΞΫΤϦΛల։͢ΕOK ہॴతͳϒϨʔΫϙΠϯτ͕ग़ͯγϡοͱॻ͚Δ
ൺֱ
ൺֱ
ݟ௨͕͠Α͘ͳͬͯ ͳΜͱͳ͘εοΩϦ
• ϝσΟΞΫΤϦΛύοͱੜ • pxΛ͚ͩ͢ • emʹมࡁΈ • TSϑϨϯυϦʔ
• ϝσΟΞΫΤϦΛύοͱੜ • pxΛ͚ͩ͢ • emʹมࡁΈ • TSϑϨϯυϦʔ • APIͷ౷ҰͰύοͱͳΔ
• mqΦϒδΣΫτΛݟΕΑ͍ • ہॴతͳϝσΟΞΫΤϦOK • ݟ௨͕͠Α͘ͳΔ
• ϝσΟΞΫΤϦΛύοͱੜ • pxΛ͚ͩ͢ • emʹมࡁΈ • TSϑϨϯυϦʔ • APIͷ౷ҰͰύοͱͳΔ
• mqΦϒδΣΫτΛݟΕΑ͍ • ہॴతͳϝσΟΞΫΤϦOK • ݟ௨͕͠Α͘ͳΔ • ϥΠϒϥϦʹґଘ͍ͯ͠ͳ͍ • CSS in JSଆͷΞοϓσʔτͰ ഁ໓͠ͳ͍(͔)
ϝσΟΞΫΤϦΛ ύοͱΕΔΑ͏ʹͳͬͯ ͢͜͠Α͘ͳͬͨ (ݸਓൺ)
ϝσΟΞΫΤϦΛ ύοͱΔͳ͠Ͱͨ͠ ऴ