footer / block / contacts refactoring
This commit is contained in:
1 parent
d0a11deae8
commit
48f7e971c9
8 files changed
+89
-70
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user