footer / block / contacts refactoring

This commit is contained in:
tmshv committed 2020-02-18 15:36:20 +03:00
1 parent d0a11deae8
commit 48f7e971c9
8 files changed
+89 -70

No files matched your search

+19 -4
View File
@@ -1,11 +1,16 @@
import cx from 'classnames'
import { createElement } from 'react'
export type BlockProps = {
as?: keyof HTMLElementTagNameMap
style?: React.CSSProperties
direction: 'horizontal' | 'vertical'
}
export const Block: React.FC<BlockProps> = props => {
return (
<div style={props.style}>
export const Block: React.FC<BlockProps> = ({ as = 'div', style, direction, ...props }) => {
const newProps = { className: cx(direction), style }
const children = (
<>
<style jsx>{`
div {
display: flex;
@@ -13,9 +18,19 @@ export const Block: React.FC<BlockProps> = props => {
align-items: baseline;
justify-content: flex-start;
}
.horizontal {
flex-direction: row;
}
.vertical {
flex-direction: column;
}
`}</style>
{props.children}
</div>
</>
)
return createElement(as, newProps, children)
}