State selector interface brainstorming for nano-css
.
Iteration 1:
const styles = block({
':scope': {
bgc: '#ed2651',
bd: 0,
bdrad: '2px',
bxz: 'border-box',
col: 'white',
h: '24px',
lh: '24px',
ov: 'hidden',
pad: '0 16px',
},
':scope[state|inverse]': {
bgc: 'white',
col: '#2e184a',
},
':scope[state|size=small]': {
h: '16px',
lh: '16px'
pad: '0px 8px',
},
'.icon': {
w: '16px',
mart: '8px',
ov: 'hidden',
height: '16px',
},
'.icon[state|animate]': {
animation: '3s ease-in 1s icon-animation',
},
});
const Button = ({size, inverse, icon, children}) => {
const style = objstr({
[styles]: true,
[styles.inverse()]: inverse,
[styles.size(size)]: true
});
return (
<button class={style}>
{icon && <span class={styles.icon}>{icon}</span>}
{children}
</button>
);
}
Iteration 2 (implicit scope):