Skip to content

Commit bd7a773

Browse files
committed
feat: 🔥 csf v3 & add antialiased globally
1 parent 465fbba commit bd7a773

File tree

7 files changed

+302
-278
lines changed

7 files changed

+302
-278
lines changed

.storybook/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module.exports = {
2-
core: { builder: "storybook-builder-vite" },
2+
features: {
3+
previewCsfV3: true,
4+
},
35
async viteFinal(config, { configType }) {
46
// customize the Vite config here
57
return config;

.storybook/preview.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const parameters = {
1616
export const decorators = [
1717
(Story, context) => {
1818
document.body.classList.add("font-sans");
19+
document.body.classList.add("antialiased");
1920

2021
return (
2122
<RenderlesskitProvider theme={theme}>

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@
9696
"@commitlint/cli": "^12.1.4",
9797
"@commitlint/config-conventional": "^12.1.4",
9898
"@release-it/conventional-changelog": "^3.0.1",
99-
"@storybook/addon-a11y": "6.3.2",
100-
"@storybook/addon-actions": "6.3.2",
101-
"@storybook/addon-essentials": "6.3.2",
99+
"@storybook/addon-a11y": "6.4.0-alpha.12",
100+
"@storybook/addon-actions": "6.4.0-alpha.12",
101+
"@storybook/addon-essentials": "6.4.0-alpha.12",
102102
"@storybook/addon-postcss": "^2.0.0",
103-
"@storybook/react": "6.3.2",
103+
"@storybook/react": "6.4.0-alpha.12",
104104
"@testing-library/dom": "^8.1.0",
105105
"@testing-library/jest-dom": "^5.14.1",
106106
"@testing-library/react": "^12.0.0",

src/newButton/Button.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export type ButtonProps = Omit<ReakitButtonProps, "prefix"> & {
1111
/**
1212
* How large should the button be?
1313
*
14-
* @default "md"
14+
* @default sm
1515
*/
1616
size?: keyof Renderlesskit.GetThemeValue<"newButton", "size">;
1717
/**
18-
* How the button should be styled?
18+
* How the button should look?
1919
*
20-
* @default "primary"
20+
* @default solid
2121
*/
2222
variant?: keyof Renderlesskit.GetThemeValue<"newButton", "variant">;
2323
};
@@ -33,7 +33,11 @@ export const Button = forwardRefWithAs<
3333

3434
const baseStyles = cx(base, _size[size], _variant[variant]);
3535

36-
return <ReakitButton className={baseStyles}>{children}</ReakitButton>;
36+
return (
37+
<ReakitButton className={baseStyles} ref={ref}>
38+
{children}
39+
</ReakitButton>
40+
);
3741
});
3842

3943
Button.displayName = "Button";

src/newButton/stories/Button.stories.tsx

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
11
import * as React from "react";
22
import { Meta } from "@storybook/react";
3-
import { storyTemplate } from "../../../.storybook/storybookUtils";
4-
import { Button, ButtonProps } from "../index";
3+
import { Button } from "../index";
4+
import { createControls } from "../../../.storybook/storybookUtils";
55

66
export default {
77
title: "Primitives/NewButton",
88
component: Button,
9+
argTypes: createControls("newButton", {
10+
unions: ["size", "variant"],
11+
ignore: [
12+
"unstable_system",
13+
"unstable_clickOnEnter",
14+
"unstable_clickOnSpace",
15+
"wrapElement",
16+
],
17+
}),
918
} as Meta;
1019

11-
const base = storyTemplate<ButtonProps>(Button, {
12-
children: "Button",
13-
size: "sm",
14-
variant: "solid",
15-
});
20+
export const Small = {
21+
args: { children: "Button", size: "sm", variant: "solid" },
22+
};
23+
console.log("%c Small", "color: #0088cc", Small);
24+
25+
export const Medium = {
26+
args: { ...Small.args, size: "md" },
27+
};
1628

17-
export const Small = base({});
18-
export const Medium = base({ size: "md" });
19-
export const Large = base({ size: "lg" });
20-
export const ExtraLarge = base({ size: "xl" });
29+
export const Large = {
30+
args: { ...Small.args, size: "lg" },
31+
};
32+
33+
export const ExtraLarge = {
34+
args: { ...Small.args, size: "xl" },
35+
};
2136

22-
export const Primary = base({});
37+
export const Solid = { ...Small };
2338

2439
export const Playground = () => {
2540
return <Button type="button">Button</Button>;

tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = preset({
99
path.resolve(__dirname, "./src/theme/defaultTheme/**/*"),
1010
path.resolve(__dirname, "./src/**/stories/*.stories.@(ts|tsx)"),
1111
path.resolve(__dirname, "./renderlesskit.config.ts"),
12+
path.resolve(__dirname, "./.storybook/**/*"),
1213
],
1314

1415
theme: {

0 commit comments

Comments
 (0)