File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import "./Box.scss " ;
1+ import { StyledBox } from "./styles " ;
22
33interface BoxProps {
44 flow ?: "horizontal" | "vertical" ;
@@ -11,19 +11,9 @@ function Box({
1111 children,
1212} : React . PropsWithChildren < BoxProps > ) {
1313 return (
14- < div
15- className = "box"
16- style = { {
17- display : "flex" ,
18- alignItems : "center" ,
19- flexDirection : flow == "horizontal" ? "row" : "column" ,
20- gap,
21- padding : gap ,
22- boxSizing : "border-box" ,
23- } }
24- >
14+ < StyledBox flow = { flow } gap = { gap } >
2515 { children }
26- </ div >
16+ </ StyledBox >
2717 ) ;
2818}
2919
Original file line number Diff line number Diff line change 1+ import styled from "@emotion/styled" ;
2+
3+ interface StyledBoxProps {
4+ flow ?: "horizontal" | "vertical" ;
5+ gap ?: number ;
6+ }
7+
8+ export const StyledBox = styled . div < StyledBoxProps > `
9+ display: "flex";
10+ align-items: "center";
11+ flex-direction: ${ ( props ) => ( props . flow == "horizontal" ? "row" : "column" ) } ;
12+ gap: ${ ( props ) => props . gap } px;
13+ padding: ${ ( props ) => props . gap } px;
14+ box-sizing: "border-box";
15+ ` ;
You can’t perform that action at this time.
0 commit comments