components uses css modules; other refactoring

This commit is contained in:
tmshv committed 2020-03-29 01:41:10 +03:00
1 parent 0cd61e0ed9
commit d65aba19a0
28 files changed
+137 -94

No files matched your search

+8 -2
View File
@@ -1,4 +1,4 @@
import './styles.css'
import s from './styles.module.css'
import cx from 'classnames'
import { createElement } from 'react'
@@ -10,7 +10,13 @@ export type BlockProps = {
}
export const Block: React.FC<BlockProps> = ({ as = 'div', style, direction, ...props }) => {
const newProps = { className: cx('block', direction), style }
const directionClass = direction === 'horizontal'
? s.horizontal
: s.vertical
const newProps = {
className: cx(s.block, directionClass),
style,
}
return createElement(as, newProps, props.children)
}
@@ -5,10 +5,10 @@
justify-content: flex-start;
}
.block.horizontal {
.horizontal {
flex-direction: row;
}
.block.vertical {
.vertical {
flex-direction: column;
}