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

Commit 5fbce68

Browse files
committed
Update button imports to use button-variants
1 parent 9aa83a9 commit 5fbce68

14 files changed

+68
-54
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
],
88
"scripts": {
99
"build": "turbo run build",
10-
"build:packages": "turbo run build --force --filter='./packages/*'",
1110
"changeset": "changeset",
1211
"clean": "turbo run clean && rm -rf .turbo node_modules",
1312
"dev": "turbo run dev",
@@ -21,7 +20,7 @@
2120
"prettier": "prettier --write --ignore-unknown .",
2221
"prettier:check": "prettier --check --ignore-unknown .",
2322
"release": "turbo run build --filter=docs^... && changeset publish",
24-
"start": "turbo run start",
23+
"start": "turbo run start --force",
2524
"storybook": "turbo run storybook",
2625
"version-packages": "changeset version"
2726
},

packages/ui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/ui
22

3+
## 0.1.90
4+
5+
### Patch Changes
6+
7+
- Update button imports to use button-variants
8+
39
## 0.1.89
410

511
### Patch Changes

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/ui",
3-
"version": "0.1.89",
3+
"version": "0.1.90",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {

packages/ui/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import '@/styles.css';
33

44
// Both Server and Client
5-
export * from '@/server/button';
5+
export * from '@/server/button-variants';
66
export * from '@/server/cn';
77
export * from '@/server/toast';
88

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import type { VariantProps } from 'class-variance-authority';
2222
import { cva } from 'class-variance-authority';
2323
import * as React from 'react';
24-
import { buttonVariants } from '@/server/button';
24+
import { buttonVariants } from '@/server/button-variants';
2525
import { cn } from '@/server/cn';
2626
import type { ButtonProps } from '@/react/button';
2727

packages/ui/src/react/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { Loader2Icon } from 'lucide-react';
33
import type { VariantProps } from 'class-variance-authority';
4-
import { buttonVariants } from '@/server/button';
4+
import { buttonVariants } from '@/server/button-variants';
55
import { cn } from '@/server/cn';
66

77
/* -----------------------------------------------------------------------------

packages/ui/src/react/calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/react/popover';
2828
import { Label } from '@/react/label';
2929
import { Input } from '@/react/input';
3030
import type { FormControl } from '@/react/form';
31-
import { buttonVariants } from '@/server/button';
31+
import { buttonVariants } from '@/server/button-variants';
3232
import {
3333
createDate,
3434
dateRegex,

packages/ui/src/react/combobox.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Slot } from '@radix-ui/react-slot';
22
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react';
33
import * as React from 'react';
4-
import { Button } from '@/react/button';
54
import type { CommandItemProps, CommandProps } from '@/react/command';
65
import {
76
Command,
@@ -15,6 +14,7 @@ import {
1514
import type { FormControl } from '@/react/form';
1615
import { Popover, PopoverContent, PopoverTrigger } from '@/react/popover';
1716
import { cn } from '@/server/cn';
17+
import { buttonVariants } from '@/server/button-variants';
1818

1919
/* -----------------------------------------------------------------------------
2020
* Utils
@@ -151,20 +151,20 @@ export function Combobox({
151151
return (
152152
<Popover onOpenChange={setOpen} open={open} variant="simple">
153153
<Trigger>
154-
<PopoverTrigger asChild>
155-
<Button
156-
block={block}
157-
className={classNameTrigger}
158-
disabled={disabled}
159-
endIcon={<ChevronsUpDownIcon size={14} />}
160-
justify="between"
161-
startIcon={icon}
162-
variant="outline"
163-
>
164-
{selected?.value
165-
? selected.label
166-
: placeholder ?? 'Select an option'}
167-
</Button>
154+
<PopoverTrigger
155+
className={cn(
156+
buttonVariants({
157+
block,
158+
variant: 'outline',
159+
justify: 'between',
160+
}),
161+
classNameTrigger,
162+
)}
163+
disabled={disabled}
164+
>
165+
{icon}
166+
{selected?.value ? selected.label : placeholder ?? 'Select an option'}
167+
<ChevronsUpDownIcon size={14} />
168168
</PopoverTrigger>
169169
</Trigger>
170170
<PopoverContent align="start">

packages/ui/src/react/data-table.tsx

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {
22
Column,
33
ColumnDef,
44
RowData,
5+
SortDirection,
56
Table as TableType,
67
TableOptions,
78
} from '@tanstack/react-table';
@@ -72,6 +73,7 @@ import {
7273
TableRow,
7374
} from '@/react/table';
7475
import { cn } from '@/server/cn';
76+
import { buttonVariants } from '@/server/button-variants';
7577

7678
/* -----------------------------------------------------------------------------
7779
* Declarations
@@ -92,6 +94,20 @@ declare module '@tanstack/table-core' {
9294
* Component: DataTableColumnHeader
9395
* -------------------------------------------------------------------------- */
9496

97+
function Icon({
98+
isSorted,
99+
}: {
100+
isSorted: false | SortDirection;
101+
}): React.JSX.Element {
102+
if (isSorted === 'desc') {
103+
return <ArrowDownIcon size={16} />;
104+
} else if (isSorted === 'asc') {
105+
return <ArrowUpIcon size={16} />;
106+
}
107+
108+
return <ChevronsUpDownIcon size={16} />;
109+
}
110+
95111
export interface DataTableColumnHeaderProps<TData, TValue> {
96112
column: Column<TData, TValue>;
97113
title: string;
@@ -101,29 +117,19 @@ export function DataTableColumnHeader<TData, TValue>({
101117
column,
102118
title,
103119
}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {
104-
const endIcon = (): React.JSX.Element => {
105-
const isSorted = column.getIsSorted();
106-
107-
if (isSorted === 'desc') {
108-
return <ArrowDownIcon size={16} />;
109-
} else if (isSorted === 'asc') {
110-
return <ArrowUpIcon size={16} />;
111-
}
112-
113-
return <ChevronsUpDownIcon size={16} />;
114-
};
115-
116120
return (
117121
<DropdownMenu>
118-
<DropdownMenuTrigger asChild>
119-
<Button
120-
className="data-state-open:bg-accent -ml-3.5 px-3.5"
121-
endIcon={endIcon()}
122-
size="sm"
123-
variant="ghost"
124-
>
125-
{title}
126-
</Button>
122+
<DropdownMenuTrigger
123+
className={cn(
124+
buttonVariants({
125+
size: 'sm',
126+
variant: 'ghost',
127+
}),
128+
'data-state-open:bg-accent -ml-3.5 px-3.5',
129+
)}
130+
>
131+
{title}
132+
<Icon isSorted={column.getIsSorted()} />
127133
</DropdownMenuTrigger>
128134

129135
<DropdownMenuContent align="start">

packages/ui/src/react/dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type { VariantProps } from 'class-variance-authority';
2020
import { cva } from 'class-variance-authority';
2121
import { XIcon } from 'lucide-react';
2222
import * as React from 'react';
23-
import { buttonVariants } from '@/server/button';
23+
import { buttonVariants } from '@/server/button-variants';
2424
import { cn } from '@/server/cn';
2525
import type { ButtonProps } from '@/react/button';
2626

0 commit comments

Comments
 (0)