Skip to content

Commit 44d1d3c

Browse files
committed
Refactor Row to use styled components
1 parent e2ad6f0 commit 44d1d3c

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/components/Row/Row.scss

Whitespace-only changes.

src/components/Row/Row.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "./Row.scss";
1+
import { StyledRow } from "./styles";
22

33
interface RowProps {
44
gap?: number;
@@ -11,18 +11,9 @@ function Row({
1111
children,
1212
}: React.PropsWithChildren<RowProps>) {
1313
return (
14-
<div
15-
className="row"
16-
style={{
17-
display: "flex",
18-
flexDirection: "row",
19-
justifyContent: "space-between",
20-
width,
21-
gap,
22-
}}
23-
>
14+
<StyledRow width={width} gap={gap}>
2415
{children}
25-
</div>
16+
</StyledRow>
2617
);
2718
}
2819

src/components/Row/styles.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import styled from "@emotion/styled";
2+
3+
interface StyledRowProps {
4+
width?: string | number;
5+
gap?: number;
6+
}
7+
export const StyledRow = styled.div<StyledRowProps>`
8+
display: flex;
9+
flex-direction: row;
10+
justify-content: space-between;
11+
width: ${(props) =>
12+
typeof props.width === "number" ? `${props.width}px` : props.width};
13+
gap: ${(props) =>
14+
typeof props.gap === "number" ? `${props.gap}px` : props.gap};
15+
`;

0 commit comments

Comments
 (0)