Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ReactFoo Mumbai - How initial designing helped ...

ReactFoo Mumbai - How initial designing helped a small team @Agrostar helped deliver apps quickly

This is about how is CSS hard to maintain and how styled-components makes job easy. Using yarn-workspaces, we can share part of the code with other projects.

Avatar for Basavaraj Sonnad

Basavaraj Sonnad

May 26, 2018

Other Decks in Programming

Transcript

  1. import styled from “styled-components”; const AgroLabel = styled.label` color: #000;

    margin: 0; font-size: 20px; ` styled-components(css-in-js)
  2. import styled from “styled-components”; const AgroLabel = styled.label` color: #000;

    margin: 0; font-size: 20px; ` styled-components(css-in-js)
  3. import styled from “styled-components”; const AgroLabel = styled.label` color: #000;

    margin: 0; font-size: ${props => { const agSize = props.agSize || "default"; return props.theme.fonts[agSize]; }} ` styled-components(css-in-js)
  4. styled label.js button.js table.js panel.js input.js theme.js • Themeing •

    SSR • Global styling • Isolated and collocated • Remember this is a subdirectory • inside main project
  5. styled label.js button.js table.js panel.js input.js theme.js • Themeing •

    SSR • global styling • Isolated and collocated • Remember this is a subdirectory • inside main project Can we reuse this ?
  6. Setup - step2 { "name": "react-foo-demo", "version": “0.0.1", "private": true,

    "workspaces": [ "packages/**" ], "dependencies": { .. } } package.json
  7. Takeaways 3. Yarn workspaces get you out of the ../../

    hell 4. Yarn workspaces lets you write code in decoupled way 5. Easy debugging 2. Yarn workspaces: Easy code sharing Takeaways 1. Using styled-components, CSS made EASY