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
Responsive Components with ReactJS
Search
David Badura
March 21, 2017
Technology
230
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Responsive Components with ReactJS
https://github.com/DavidBadura/react-responsive-components-slides
David Badura
March 21, 2017
More Decks by David Badura
See All by David Badura
Exploring Projections and Processors in Event Sourcing
davidbadura
0
54
phpitfalls - cologne
davidbadura
0
190
PostCSS Mythbusting
davidbadura
1
230
Other Decks in Technology
See All in Technology
RAGの精度向上とエージェント活用
kintotechdev
2
130
最近評価が難しくなった
maroon8021
0
210
AWS Summit Japan 2026の振り返りと2027へ向けて / AWS Summit Japan 2026 Recap and Prospects for 2027
kaminashi
1
190
製造現場での生成AIの活用、およびエージェントAIの実装のあり方、AVEVAの取り組み
iotcomjpadmin
0
220
アラート調査向けAIエージェントの本番導入とその後/AI Agents for Alert Investigation: Production Deployment and After
taddy_919
1
360
組織における AI-DLC 実践
askul
0
300
MySQL & MySQL HeatWave Report - June 2026
freshdaz
0
300
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
250
5分でわかるDuckDB Quack
chanyou0311
4
310
小さいから、全部わかる。— 常駐AI "xangi" のすすめ
sugupoko
0
250
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
デジタル・デザイン構想 by Sayaka Ishizuka
y150saya
0
190
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
BBQ
matthewcrist
89
10k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
Mind Mapping
helmedeiros
PRO
1
280
The agentic SEO stack - context over prompts
schlessera
0
840
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
HDC tutorial
michielstock
2
730
Between Models and Reality
mayunak
4
360
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Transcript
with ReactJS <RESPONSIVE-COMPONENTS/>
DAVID BADURA Software Developer @ i22 Digitalagentur GmbH Loves ReactJS,
Symfony & Simplicity
WHAT IS REACTJS?
SKIP PLEASE
WHAT WE WANT?
1) ENCAPSULATED COMPONENTS
2) RESPONSIVE LAYOUTS
WE WANT MORE Performance Simplicity Pizza ...
BUT FOCUS ON
WHAT WE HAVE?
MEDIA QUERY .image { height: 200px; } @media (min-width: 500px)
{ .image { width: 200px; float: left; } } @media (min-width: 600px) { .top .image { width: 200px; float: left; } .image { width: 280px; float: none; } }
None
None
None
ENCAPSULATED? not really
WHAT WE REALLY WANT?
ENCAPSULATED RESPONSIVE COMPONENTS
CONTAINER QUERY .image { height: 200px; } .item:media(min-width: 460px) {
.image { width: 200px; float: left; } }
CONTAINER QUERY Container queries allow an author to control styling
based on the size of a containing element rather than the size of the user ’s viewport. - Container Queries - Editor’s Draft, 5 June 2015
NO SUPPORT IN ANY BROWSER
None
MAGIC!
import React from "react"; import {applyContainerQuery} from "react-container-query" ; import
classnames from 'classnames'; const query = { 'width-between-400-and-599' : { minWidth: 400, maxWidth: 599 }, 'width-larger-than-600' : { minWidth: 600, } }; export default applyContainerQuery(class extends React.Component { render() { return ( <div classNames={classnames(this.props.containerQuery)}> // ... </div> ); } }, query);
HOW? Never ask questions you don't want to known the
answers to
import React from "react"; import {applyContainerQuery} from "react-container-query" ; import
Slider from "./Slider"; import Grid from "./Grid"; export default applyContainerQuery(class Content extends React.Component { render() { return ( <div> {this.props.containerQuery.small ? <Slider data={this.props.data} /> : <Grid data={this.props.data} />} </div> ); } }, { 'small': { maxWidth: 599 } });
BUT HOW?
REACT-CONTAINER-QUERY Modular responsive component. With dependency on...
ELEMENT-RESIZE-DETECTOR Super-optimized cross-browser resize listener for elements.
!!! WARNING !!! For information on risks and side-effects please
read the documentaion and ask your doctor or pharmacist.
None
BUT IT WORKS! And it's super fast!
THIS FEATURE IS COMING SOON ... in one or two
years ... maybe ...
RESIZEOBSERVER ResizeObserver allows you to be notified when an element’s
content rectangle has changed its size, and react accordingly. (ResizeObserver is in Chrome 54)
const ro = new ResizeObserver( entries => { for (let
entry of entries) { const cr = entry.contentRect; console.log('Element:', entry.target); console.log(`Element size: ${cr.width}px x ${cr.height}px`); console.log(`Element padding: ${cr.top}px ; ${cr.left}px`); } }); // Observe one or multiple elements ro.observe(someElement);
QUESTIONS?
@DavidBadura
#bonn-devs https://slackinvite.me/to/bonn-devs
REFERENCES http://responsiveimagescg.github.io/container-queries https://tomhodgins.github.io/element-queries-spec/element-queries.html https://developers.google.com/web/updates/2016/10/resizeobserver https://www.sitepoint.com/responsive-web-components https://github.com/wnr/element-resize-detector https://github.com/d6u/react-container-query https://www.i22.de/
<THANKS!/>