SlideShare a Scribd company logo
1 of 14
styled-components
www.sli.do #FMKE5
www.sli.do #FMKE5
CSS sucks
www.sli.do #FMKE5
React
HTML + JS = JSX
www.sli.do #FMKE5
React
HTML + CSS + JS = JSX
www.sli.do #FMKE5
Motivation
.btn { … }
<Button />
www.sli.do #FMKE5
Profit?
- izolované štýlovanie
- nesting ako v SASS
- je to len CSS
- variables, functions, atď…
- témy
- React Native
- je to Javascript
www.sli.do #FMKE5
Basic React component …
const Product = (props) => {
return <div>
<div>{props.name}</div>
<div>{props.price}</div>
</div>;
}
www.sli.do #FMKE5
… with styled components
const Product = (props) => {
return <Wrapper>
<Title>{props.name}</Title>
<Price>{props.price}</Price>
</Wrapper>;
}
www.sli.do #FMKE5
Styled Components
const Title = styled.div`
font-size: 20px
`;
const Price = styled.div`
color: ${({theme}) => theme.primary};
www.sli.do #FMKE5
Themes
Sidebar Content
HeaderHeader
Sidebar ContentContent
www.sli.do #FMKE5
DEMO TIME
www.sli.do #FMKE5
Q&A

More Related Content

Similar to Frontend Masters Košice - Styled Components

Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in Rails
Benjamin Vandgrift
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 

Similar to Frontend Masters Košice - Styled Components (20)

[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX
 
Middleman Usecase / TokyouMiddlemanMeetup#1
Middleman Usecase / TokyouMiddlemanMeetup#1Middleman Usecase / TokyouMiddlemanMeetup#1
Middleman Usecase / TokyouMiddlemanMeetup#1
 
Dominate The Theme Layer
Dominate The Theme LayerDominate The Theme Layer
Dominate The Theme Layer
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Survey of Front End Topics in Rails
Survey of Front End Topics in RailsSurvey of Front End Topics in Rails
Survey of Front End Topics in Rails
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
How to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public ReleaseHow to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public Release
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Prioritize your critical css and images to render your site fast velocity ny...
Prioritize your critical css and images to render your site fast  velocity ny...Prioritize your critical css and images to render your site fast  velocity ny...
Prioritize your critical css and images to render your site fast velocity ny...
 
From CSS to Sass in WordPress
From CSS to Sass in WordPressFrom CSS to Sass in WordPress
From CSS to Sass in WordPress
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單
 
20110820 header new style
20110820 header new style20110820 header new style
20110820 header new style
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Refresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End StoryRefresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End Story
 
Mason - A Template system for us Perl programmers
Mason - A Template system for us Perl programmersMason - A Template system for us Perl programmers
Mason - A Template system for us Perl programmers
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
[SUTD GDSC] Intro to HTML and CSS
[SUTD GDSC] Intro to HTML and CSS[SUTD GDSC] Intro to HTML and CSS
[SUTD GDSC] Intro to HTML and CSS
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 

More from bart-sk

Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearch
bart-sk
 
Digitálne zážitky v internetových obchodoch v roku 2018
Digitálne zážitky v internetových obchodoch v roku 2018Digitálne zážitky v internetových obchodoch v roku 2018
Digitálne zážitky v internetových obchodoch v roku 2018
bart-sk
 
Frontend Masters Košice - Ako postaviť frontend nad kvalitným API
Frontend Masters Košice - Ako postaviť frontend nad kvalitným APIFrontend Masters Košice - Ako postaviť frontend nad kvalitným API
Frontend Masters Košice - Ako postaviť frontend nad kvalitným API
bart-sk
 
Frontend Masters Košice - Kvalitné API pre frontenďáka
Frontend Masters Košice - Kvalitné API pre frontenďákaFrontend Masters Košice - Kvalitné API pre frontenďáka
Frontend Masters Košice - Kvalitné API pre frontenďáka
bart-sk
 

More from bart-sk (14)

Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearch
 
Ako na eshop, ktorý si vaši zákazníci zamilujú?
Ako na eshop, ktorý si vaši zákazníci zamilujú?Ako na eshop, ktorý si vaši zákazníci zamilujú?
Ako na eshop, ktorý si vaši zákazníci zamilujú?
 
eHealth po našom – Ako vyvíjame a testujeme medicínsku appku pre 24 krajín sveta
eHealth po našom – Ako vyvíjame a testujeme medicínsku appku pre 24 krajín svetaeHealth po našom – Ako vyvíjame a testujeme medicínsku appku pre 24 krajín sveta
eHealth po našom – Ako vyvíjame a testujeme medicínsku appku pre 24 krajín sveta
 
Digitálne zážitky v internetových obchodoch v roku 2018
Digitálne zážitky v internetových obchodoch v roku 2018Digitálne zážitky v internetových obchodoch v roku 2018
Digitálne zážitky v internetových obchodoch v roku 2018
 
Frontend Developer v roku 2018
Frontend Developer v roku 2018Frontend Developer v roku 2018
Frontend Developer v roku 2018
 
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiťČo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
 
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiťČo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
Čo je to použiteľnosť webu a 5 tipov ako ju zlepšiť
 
Ako sme prerábali košík - zachej.sk
Ako sme prerábali košík - zachej.skAko sme prerábali košík - zachej.sk
Ako sme prerábali košík - zachej.sk
 
Frontend Masters Košice - Ako postaviť frontend nad kvalitným API
Frontend Masters Košice - Ako postaviť frontend nad kvalitným APIFrontend Masters Košice - Ako postaviť frontend nad kvalitným API
Frontend Masters Košice - Ako postaviť frontend nad kvalitným API
 
Frontend Masters Košice - Kvalitné API pre frontenďáka
Frontend Masters Košice - Kvalitné API pre frontenďákaFrontend Masters Košice - Kvalitné API pre frontenďáka
Frontend Masters Košice - Kvalitné API pre frontenďáka
 
Frontend Masters Košice - oAuth
Frontend Masters Košice - oAuthFrontend Masters Košice - oAuth
Frontend Masters Košice - oAuth
 
9 typov ako zvýšiť úspešnosť vášho eshopu
9 typov ako zvýšiť úspešnosť vášho eshopu9 typov ako zvýšiť úspešnosť vášho eshopu
9 typov ako zvýšiť úspešnosť vášho eshopu
 
Frontend Masters Košice - Zeplin v praxi
Frontend Masters Košice - Zeplin v praxiFrontend Masters Košice - Zeplin v praxi
Frontend Masters Košice - Zeplin v praxi
 
Frontend Masters Košice - Debuggovanie a optimalizácia react.js aplikácií
Frontend Masters Košice - Debuggovanie a optimalizácia react.js aplikáciíFrontend Masters Košice - Debuggovanie a optimalizácia react.js aplikácií
Frontend Masters Košice - Debuggovanie a optimalizácia react.js aplikácií
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Frontend Masters Košice - Styled Components

Editor's Notes

  1. kto si čo robíš
  2. stránky boli kedysi jednoduché výber správneho nástroja pre prácu, bezohľadu na to, čo tu poviem prišli SPA a s nimi frameworky =>
  3. robil som v oboch CSS na druhej koľaji, ide si svojou cestou, nie je nijako zviazané SASS a LESS to vylepšili (premenné, fcie) ale nevyriešili premenné zo SASS nie je možné využiť v JS a naopak bootstrap bezohľadu na to, CSS je zlé =>
  4. zmena štýlu tlačidla nesmie ovplyvniť layout tlačidlo a vôbec každý komponent musí byť samostatný a izolovaný, aby bolo bezpečné ho meniť
  5. príklady v Reacte najjednoduchšie možné príklady, každý by mal pochopiť
  6. prečo mať CSS oddelené? môže byť súčasťou komponentu
  7. … všetky div nahradíme styled komponentami
  8. Wrapper ako konvencia pre obaľovací (root) komponent použitie sa nezmenilo