Skip to content

Commit

Permalink
Spacing and border radius (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinwenisch authored Sep 3, 2024
1 parent 1029d2d commit 18c35de
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/design-system/config/borderRadius.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ThemeConfig } from "tailwindcss/types/config";

const borderRadius: Pick<Partial<ThemeConfig>, "borderRadius"> = {
// !!! We replace the default Tailwind CSS borderRadius scale with our own
borderRadius: {
none: "0px",
DEFAULT: "1rem",
md: "1.5rem",
lg: "2rem",
full: "9999px",
},
};

export default borderRadius;
15 changes: 15 additions & 0 deletions packages/design-system/config/spacing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ThemeConfig } from "tailwindcss/types/config";

const spacing: Pick<Partial<ThemeConfig>, "spacing"> = {
// We're adding these as a default spacing scale, but feel free to use any multiplies of 0.25rem as part of default Tailwind CSS spacing scale e.g. h-10 p-2
spacing: {
xxs: "0.25rem",
xs: "0.5rem",
sm: "1rem",
md: "1.5rem",
lg: "2rem",
xl: "3rem",
},
};

export default spacing;
2 changes: 1 addition & 1 deletion packages/design-system/src/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Props = {
};

const Heading = ({ children }: Props): JSX.Element => {
return <h1 className="k1-text-primary">{children}</h1>;
return <h1 className="k1-text-primary k1-px-md k1-h-xl">{children}</h1>;
};

export { Heading };
5 changes: 5 additions & 0 deletions packages/design-system/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Config } from "tailwindcss";
import colors from "./config/colors";
import typography from "./config/typography";
import spacing from "./config/spacing";
import borderRadius from "./config/borderRadius";

// Each package is responsible for its own content
const config: Config = {
Expand All @@ -10,7 +12,10 @@ const config: Config = {
extend: {
...colors,
...typography,
...spacing,
},
// Replace the default Tailwind CSS with our own
...borderRadius,
},
plugins: [],
};
Expand Down

0 comments on commit 18c35de

Please sign in to comment.