Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 1f58efa

Browse files
committed
refactor: button icons
1 parent 02f1f8f commit 1f58efa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+156
-153
lines changed

apps/docs/src/app/page.tsx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
import {
2+
Button,
3+
Card,
4+
CardContent,
5+
CardDescription,
6+
CardFooter,
7+
CardHeader,
8+
CardTitle,
9+
Switch,
10+
} from '@codefixlabs/ui/react';
11+
import { BellIcon, CheckIcon } from 'lucide-react';
12+
13+
const notifications = [
14+
{
15+
description: '1 hour ago',
16+
title: 'Your call has been confirmed.',
17+
},
18+
{
19+
description: '1 hour ago',
20+
title: 'You have a new message!',
21+
},
22+
{
23+
description: '2 hours ago',
24+
title: 'Your subscription is expiring soon!',
25+
},
26+
];
27+
128
export default function Home(): React.JSX.Element {
229
return (
330
<main className="flex h-full flex-col items-center justify-center">
@@ -6,6 +33,53 @@ export default function Home(): React.JSX.Element {
633
<pre className="select-all rounded-lg border px-3 py-2">
734
bun storybook
835
</pre>
36+
37+
<Card className="w-screen max-w-md">
38+
<CardHeader>
39+
<CardTitle>Notifications</CardTitle>
40+
<CardDescription>You have 3 unread messages.</CardDescription>
41+
</CardHeader>
42+
<CardContent className="grid gap-4">
43+
<div className="flex items-center space-x-4 rounded-md border p-4">
44+
<BellIcon className="h-4 w-4 shrink-0" />
45+
<div className="flex-1 space-y-1">
46+
<p className="text-sm font-medium leading-none">
47+
Push Notifications
48+
</p>
49+
<p className="text-muted-foreground text-sm">
50+
Send notifications to device.
51+
</p>
52+
</div>
53+
<Switch />
54+
</div>
55+
<div>
56+
{notifications.map((notification) => (
57+
<div
58+
className="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0"
59+
key={notification.title}
60+
>
61+
<span className="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500" />
62+
<div className="space-y-1">
63+
<p className="text-sm font-medium leading-none">
64+
{notification.title}
65+
</p>
66+
<p className="text-muted-foreground text-sm">
67+
{notification.description}
68+
</p>
69+
</div>
70+
</div>
71+
))}
72+
</div>
73+
</CardContent>
74+
<CardFooter>
75+
<Button
76+
className="w-full"
77+
startIcon={<CheckIcon className="h-4 w-4" />}
78+
>
79+
Mark all as read
80+
</Button>
81+
</CardFooter>
82+
</Card>
983
</div>
1084
</main>
1185
);

apps/docs/src/components/ui/button/button.stories.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Button } from '@codefixlabs/ui/react';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import {
4-
ActivitySquare,
5-
ArrowUpRightSquare,
6-
GanttChartSquare,
7-
GitFork,
4+
ActivitySquareIcon,
5+
ArrowUpRightSquareIcon,
6+
GanttChartSquareIcon,
7+
GitForkIcon,
88
} from 'lucide-react';
99

1010
const icons = {
11-
ActivitySquare,
12-
ArrowUpRightSquare,
13-
GanttChartSquare,
14-
GitFork,
11+
ActivitySquareIcon: <ActivitySquareIcon className="h-4 w-4" />,
12+
ArrowUpRightSquareIcon: <ArrowUpRightSquareIcon className="h-4 w-4" />,
13+
GanttChartSquareIcon: <GanttChartSquareIcon className="h-4 w-4" />,
14+
GitForkIcon: <GitForkIcon className="h-4 w-4" />,
1515
};
1616

1717
const meta: Meta<typeof Button> = {
@@ -89,7 +89,7 @@ export const Basic: Story = {
8989

9090
export const Icon: Story = {
9191
args: {
92-
startIcon: GitFork,
92+
startIcon: <GitForkIcon className="h-4 w-4" />,
9393
},
9494
};
9595

@@ -166,13 +166,13 @@ export const Disabled: Story = {
166166
export const IconLeft: Story = {
167167
args: {
168168
...Basic.args,
169-
startIcon: GitFork,
169+
startIcon: <GitForkIcon className="h-4 w-4" />,
170170
},
171171
};
172172

173173
export const IconRight: Story = {
174174
args: {
175175
...Basic.args,
176-
endIcon: GanttChartSquare,
176+
endIcon: <GanttChartSquareIcon className="h-4 w-4" />,
177177
},
178178
};

apps/docs/src/components/ui/card/card.stories.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ const notifications = [
4949

5050
export const Basic: Story = {
5151
args: {
52-
className: 'w-md',
52+
className: 'max-w-md',
5353
},
5454
render: (args) => (
5555
<Card {...args}>
56-
{}
5756
<CardHeader>
5857
<CardTitle>Notifications</CardTitle>
5958
<CardDescription>You have 3 unread messages.</CardDescription>
6059
</CardHeader>
61-
<CardContent className="grid gap-4">
60+
<CardContent className="grid gap-6">
6261
<div className="flex items-center space-x-4 rounded-md border p-4">
6362
<BellIcon className="h-4 w-4" />
6463
<div className="flex-1 space-y-1">
@@ -74,7 +73,7 @@ export const Basic: Story = {
7473
<div>
7574
{notifications.map((notification) => (
7675
<div
77-
className="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0"
76+
className="mb-2 grid grid-cols-[25px_1fr] items-start pb-2 last:mb-0 last:pb-0"
7877
key={notification.title}
7978
>
8079
<span className="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500" />
@@ -91,7 +90,7 @@ export const Basic: Story = {
9190
</div>
9291
</CardContent>
9392
<CardFooter>
94-
<Button className="w-full" startIcon={CheckIcon}>
93+
<Button className="w-full" startIcon={<CheckIcon />}>
9594
Mark all as read
9695
</Button>
9796
</CardFooter>
@@ -105,7 +104,7 @@ export const Basic: Story = {
105104

106105
export const WithForm: Story = {
107106
args: {
108-
className: 'w-md',
107+
className: 'max-w-md',
109108
},
110109
render: (args) => (
111110
<Card {...args}>

apps/docs/src/components/ui/collapsible/collapsible.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function CollapsibleWithHooks(): React.JSX.Element {
3333
<CollapsibleTrigger asChild>
3434
<Button
3535
aria-label="Toggle"
36-
startIcon={ChevronsUpDownIcon}
36+
startIcon={<ChevronsUpDownIcon className="h-4 w-4" />}
3737
variant="ghost"
3838
/>
3939
</CollapsibleTrigger>

apps/docs/src/components/ui/combobox/combobox.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@ function ComboboxAssignMemberWithCustomTrigger(): React.JSX.Element {
228228
return (
229229
<Popover onOpenChange={setOpen} open={open} variant="simple">
230230
<PopoverTrigger asChild className="data-state-open:bg-accent">
231-
<Button size="sm" startIcon={UserPlus2Icon} variant="ghost">
231+
<Button
232+
size="sm"
233+
startIcon={<UserPlus2Icon className="h-4 w-4" />}
234+
variant="ghost"
235+
>
232236
Allocate task
233237
</Button>
234238
</PopoverTrigger>

apps/docs/src/components/ui/data-table/data-table.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const columns: ColumnDef<Payment>[] = [
109109
<Button
110110
aria-label="Open menu"
111111
className="data-state-open:bg-accent"
112-
startIcon={MoreHorizontalIcon}
112+
startIcon={<MoreHorizontalIcon className="h-4 w-4" />}
113113
variant="ghost"
114114
/>
115115
</DropdownMenuTrigger>

apps/docs/src/components/ui/dropdown-menu/dropdown-menu.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function DropdownMenuWithHooks(
4444
<Button
4545
aria-label="Customise options"
4646
shape="pill"
47-
startIcon={MenuIcon}
47+
startIcon={<MenuIcon className="h-4 w-4" />}
4848
variant="outline"
4949
/>
5050
</DropdownMenuTrigger>

apps/docs/src/components/ui/popover/popover.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Basic: Story = {
2929
<Button
3030
aria-label="Update dimensions"
3131
shape="pill"
32-
startIcon={SlidersHorizontalIcon}
32+
startIcon={<SlidersHorizontalIcon className="h-4 w-4" />}
3333
variant="outline"
3434
/>
3535
</PopoverTrigger>

apps/docs/src/components/ui/tooltip/tooltip.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Basic: Story = {
3030
<Button
3131
aria-label="Customise options"
3232
shape="pill"
33-
startIcon={PlusIcon}
33+
startIcon={<PlusIcon className="h-4 w-4" />}
3434
variant="outline"
3535
/>
3636
</TooltipTrigger>

packages/eslint-config-codefixlabs/react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = {
2222
'import/no-default-export': 'off',
2323
'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
2424
'newline-before-return': 'error',
25+
'no-undef': 'off',
2526
'sort-keys': ['error', 'asc', { natural: true }],
2627
},
2728
settings: {

packages/hooks/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export default defineConfig((options: Options) => ({
99
format: ['esm', 'cjs'],
1010
minify: true,
1111
sourcemap: true,
12-
splitting: false,
12+
splitting: true,
1313
...options,
1414
}));

packages/lib/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export default defineConfig((options: Options) => ({
99
format: ['esm', 'cjs'],
1010
minify: true,
1111
sourcemap: true,
12-
splitting: false,
12+
splitting: true,
1313
...options,
1414
}));

packages/tailwindcss/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export default defineConfig((options: Options) => ({
99
format: ['esm', 'cjs'],
1010
minify: true,
1111
sourcemap: true,
12-
splitting: false,
12+
splitting: true,
1313
...options,
1414
}));

packages/ui/src/cva/button.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type ButtonVariant =
1010
| 'primary'
1111
| 'secondary';
1212

13-
const sizes: {
13+
const btnSizes: {
1414
icon: boolean;
1515
sizes: {
1616
className: ClassValue;
@@ -21,6 +21,7 @@ const sizes: {
2121
{
2222
icon: true,
2323
sizes: [
24+
// --- sm
2425
{
2526
className: 'px-2 h-8',
2627
size: 'sm',
@@ -31,7 +32,7 @@ const sizes: {
3132
size: 'sm',
3233
variant: ['outline'],
3334
},
34-
// ---
35+
// --- md
3536
{
3637
className: 'px-3 h-10',
3738
size: 'md',
@@ -42,7 +43,7 @@ const sizes: {
4243
size: 'md',
4344
variant: ['outline'],
4445
},
45-
// ---
46+
// --- lg
4647
{
4748
className: 'px-4 h-12',
4849
size: 'lg',
@@ -58,6 +59,7 @@ const sizes: {
5859
{
5960
icon: false,
6061
sizes: [
62+
// --- sm
6163
{
6264
className: 'px-4 h-8',
6365
size: 'sm',
@@ -68,7 +70,7 @@ const sizes: {
6870
size: 'sm',
6971
variant: ['outline'],
7072
},
71-
// ---
73+
// --- md
7274
{
7375
className: 'px-5 h-10',
7476
size: 'md',
@@ -79,7 +81,7 @@ const sizes: {
7981
size: 'md',
8082
variant: ['outline'],
8183
},
82-
// ---
84+
// --- lg
8385
{
8486
className: 'px-6 h-12',
8587
size: 'lg',
@@ -95,13 +97,13 @@ const sizes: {
9597
];
9698

9799
// Flatten the array and group variants if the size is the same
98-
const compoundSizes = sizes.flatMap<{
100+
const compoundSizes = btnSizes.flatMap<{
99101
className: ClassValue;
100102
icon: boolean;
101103
size: ButtonSize;
102104
variant: ButtonVariant[];
103-
}>(({ icon, sizes: _sizes }) =>
104-
_sizes.map(({ variant, size, className }) => ({
105+
}>(({ icon, sizes }) =>
106+
sizes.map(({ variant, size, className }) => ({
105107
className,
106108
icon,
107109
size,
@@ -114,6 +116,7 @@ export const buttonVariants = cva(
114116
'relative select-none items-center gap-2 whitespace-nowrap text-sm font-medium transition-colors',
115117
'focus:ring-ring/40 focus:outline-none focus:ring-2',
116118
'data-disabled:cursor-not-allowed',
119+
'data-disabled:ring-0',
117120
],
118121
{
119122
compoundVariants: [

packages/ui/src/mail/forgot-password-template.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
Tailwind,
1111
Text,
1212
} from '@react-email/components';
13-
import * as React from 'react';
1413

1514
export function ForgotPasswordTemplate({
1615
resetPasswordLink,

packages/ui/src/mail/magic-link-template.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
Tailwind,
1111
Text,
1212
} from '@react-email/components';
13-
import * as React from 'react';
1413

1514
export function MagicLinkTemplate({
1615
magicLink,

packages/ui/src/mail/verify-email-template.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
Tailwind,
1111
Text,
1212
} from '@react-email/components';
13-
import * as React from 'react';
1413

1514
export function VerifyEmailTemplate({
1615
verifyEmailLink,

packages/ui/src/react/accordion.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Trigger,
99
} from '@radix-ui/react-accordion';
1010
import { ChevronDownIcon } from 'lucide-react';
11-
import * as React from 'react';
1211
import { forwardRef } from 'react';
1312
import { twMerge } from 'tailwind-merge';
1413

packages/ui/src/react/alert-dialog.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '@radix-ui/react-alert-dialog';
1414
import type { VariantProps } from 'class-variance-authority';
1515
import { cx } from 'class-variance-authority';
16-
import * as React from 'react';
1716
import { createContext, forwardRef, useContext } from 'react';
1817
import { twMerge } from 'tailwind-merge';
1918
import { alertDialogContentVariants, buttonVariants } from '@/cva';

0 commit comments

Comments
 (0)