Skip to content

Commit 53a23b4

Browse files
authored
Merge pull request #465 from code0-tech/feat/#461
Spacing component
2 parents 3063883 + 2c1298a commit 53a23b4

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@use "../../styles/variables";
2+
3+
.spacing {
4+
position: relative;
5+
}
6+
7+
@each $name, $size in variables.$sizes {
8+
.spacing--#{$name} {
9+
margin-bottom: $size;
10+
}
11+
}

src/components/spacing/Spacing.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
import {Code0Component, Code0Sizes, mergeCode0Props} from "../../utils";
3+
4+
export interface SpacingProps extends Code0Component<HTMLDivElement> {
5+
spacing: Code0Sizes
6+
}
7+
8+
export const Spacing: React.FC<SpacingProps> = (props) => {
9+
10+
const {spacing, ...rest} = props
11+
12+
return <div {...mergeCode0Props(`spacing spacing--${spacing}`, rest)}/>
13+
14+
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export * from "./components/quote/Quote"
2525
export * from "./components/row/Row"
2626
export * from "./components/scroll-area/ScrollArea"
2727
export * from "./components/segmented-control/SegmentedControl"
28+
export * from "./components/spacing/Spacing"
2829
export * from "./components/text/Text"
2930
export * from "./components/tooltip/Tooltip"
3031

src/styles/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ $hierarchySecondary: 0.75;
2222
$hierarchyTertiary: 0.5;
2323

2424
$sizes: (
25+
"xxs": $xxs,
2526
"xs": $xs,
2627
"sm": $sm,
2728
"md": $md,

src/utils/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export type Color = "primary" | "secondary" | "info" | "success" | "warning" | "
44

55
export const Colors: Color[] = ["primary", "secondary", "info", "success", "warning", "error"]
66

7-
export type Code0Sizes = "xs" | "sm" | "md" | "lg" | "xl";
7+
export type Code0Sizes = "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
88

9-
export type Code0FontSizes = "0.75" | "0.8" | "1" | "1.2" | "1.25"
9+
export type Code0FontSizes = "0.35" | "0.7" | "0.8" | "1" | "1.2" | "1.3"
1010

1111
export type StyleProp<Value> = Value;
1212

0 commit comments

Comments
 (0)