Jeremias Menichelli
Front end engineer, focusing on animation, web architecture and design systems for the last years
From Argentina, living in Barcelona
I don't put pineapple on pizza
@jeremenichelli on twitter,
jeremenichelli.io on the internets
kinda efficient
kinda consistent
kinda scalable
DESIGN SYSTEM
ENGINEERING TEAM
ENGINEERING TEAM
ENGINEERING TEAM
ENGINEERING TEAM
import React from 'react'
import Dialog from 'your-design-system'
import Modal from 'your-design-system'
import Drawer from 'your-design-system'
const Screen = () => (
<>
<Dialog visible />
<Modal open />
<Drawer closed={false} />
</>
)
requires the user to re-learn a new interface
puts engineers in a focus switching situation
import React from 'react'
import Dropdown from 'your-design-system'
const Screen = ({ dropdownValue }) => (
<>
<Dropdown
value={dropdownValue}
options={[ 'leia', 'luke' ]}
renderHeader={value => <span className="custom-header">{value}</span>}
renderOption={value => <span className="custom-option">{value}</span>}
/>
</>
)
an interface open to an unexpected behavior leads to unexpected usage, which leads to unexpected bugs
you are distributing behavior, you are not distributing design
Fear leads to anger. Anger leads to hate. Hate leads to suffering.
PLAN looking at the past
VALIDATE for the future
EXECUTE in the present
import React from 'react'
import styled from 'styled-components'
const DialogWrapper = styled.div`
display: ${props => props.visible ? 'flex' : 'none'};
position: fixed;
top: 0;
left: 0;
height: 100%;
align-items: center;
justify-items: center;
`
const Dialog = props => <DialogWrapper {...props}>
export default Dialog
import React from 'react'
import styled from 'styled-components'
const DialogWrapper = styled.div`
display: ${p => p.visible ? 'flex' : 'none'};
position: fixed;
top: 0;
left: 0;
height: 100%;
align-items: center;
justify-items: center;
`
const Dialog = props => <DialogWrapper {...props}>
export default Dialog
✅ shows using "visible" prop
✅ hides when "visible" prop is false
function getVisibility(props) {
if (props.visible) {
return 'flex'
}
return 'none'
}
const DialogWrapper = styled.div`
display: ${p => getVisiblity(p);
position: fixed;
top: 0;
left: 0;
height: 100%;
align-items: center;
justify-items: center;
`
✅ shows using "visible" prop
✅ hides when "visible" prop is false
function getVisibility(props) {
if (props.visible) {
return 'flex'
}
if (props.isOpen) {
return 'flex'
}
return 'none'
}
const DialogWrapper = styled.div`
display: ${p => getVisiblity(p);
position: fixed;
top: 0;
left: 0;
height: 100%;
align-items: center;
justify-items: center;
`
✅ shows using "visible" prop
✅ shows using "isOpen" prop
✅ hides when "visible" prop is false
import { VISIBLE_PROP_MESSAGE } from './messages'
import warn from '../utils/warn'
function getVisibility(props) {
if (props.visible) {
if (process.env.NODE_ENV !== 'production') warn(VISIBLE_PROP_MESSAGE)
return 'flex'
}
if (props.isOpen) {
return 'flex'
}
return 'none'
}
✅ shows using "visible" prop
✅ warns about "visible" usage
✅ shows using "isOpen" prop
✅ hides when "visible" prop is false
import React from 'react'
import { shallow } from 'enzyme'
import Dialog from './dialog'
import { VISIBLE_PROP_MESSAGE } from './messages'
describe('Dialog', () => {
it('warns of "visible" legacy usage', () => {
console.error = jest.fn()
shallow(<Dialog visible={true}/>)
console.error.toHaveBeenCalledWith(VISIBLE_PROP_MESSAGE)
})
})
import { VISIBLE_PROP_MESSAGE } from './messages'
import warn from '../utils/warn'
function getVisibility(props) {
if (props.visible) {
if (process.env.NODE_ENV !== 'production') warn(VISIBLE_PROP_MESSAGE)
return 'flex'
}
if (props.isOpen) {
return 'flex'
}
return 'none'
}
⛔️ shows using "visible" prop
⛔️ warns about "visible" usage
✅ shows using "isOpen" prop
⛔️hides when "visible" prop is false
import React from 'react'
import styled from 'styled-components'
const DialogWrapper = styled.div`
display: ${p => p.isOpen ? 'flex' : 'none'};
position: fixed;
top: 0;
left: 0;
height: 100%;
align-items: center;
justify-items: center;
`
const Dialog = props => <DialogWrapper {...props}>
export default Dialog
import React from 'react'
import styled from 'styled-components'
import LegacyDialog from './legacy'
import Dialog from './new-dialog'
import { VISIBLE_PROP_MESSAGE } from './messages'
import warn from '../utils/warn'
const Dialog = props => {
if (props.visible) {
if (process.env.NODE_ENV !== 'production') warn(VISIBLE_PROP_MESSAGE)
return <LegacyDialog {...props}>
}
return <Dialog {...props}>
}
export default Dialog
DESIGN SYSTEM
ENGINEERING TEAM
ENGINEERING TEAM
ENGINEERING TEAM
ENGINEERING TEAM
DESIGNER
YOU
YOU
YOU
const SOME_COLOR_THAT_GETS_REPEATED_A_LOT = '#abc'
const WARNING = '#f9a602'
but paid
Jeremias Menichelli
@jeremenichelli on twitter,
jeremenichelli.io on the internets
"Paving the adoption path of your Design System for engineers"