Skip to content

Commit

Permalink
remove font sizes everywhere. set font size to 12px. fix broken button
Browse files Browse the repository at this point in the history
  • Loading branch information
quinn committed Jan 28, 2024
1 parent 0080f76 commit 3e42c26
Show file tree
Hide file tree
Showing 20 changed files with 253 additions and 250 deletions.
2 changes: 1 addition & 1 deletion src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function Root() {
<div className="row-span-3 p-3 border-r text-center">
<div className="flex flex-col justify-between h-full">
<div>
<Button variant="ghost" size="icon">
<Button variant="ghost" size="icon" asChild>
<Link to={Page.TABLE}>
<TableIcon />
</Link>
Expand Down
5 changes: 3 additions & 2 deletions src/components/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const transactionColumns: ColumnDef<TransactionType>[] = [
id: 'icon',
accessorFn: (row) => row.logoUrl || row.categoryIconUrl,
header: () => {
return <span className="text-xs">Icon</span>
return <span>Icon</span>
},
cell: (ctx) => {
const value = ctx.getValue()
Expand Down Expand Up @@ -91,6 +91,7 @@ export const transactionColumns: ColumnDef<TransactionType>[] = [
{
id: 'account',
accessorFn: (row) => row.account?.name,
enableColumnFilter: true,
},
{
header: ({ column }) => {
Expand All @@ -100,7 +101,7 @@ export const transactionColumns: ColumnDef<TransactionType>[] = [
},
{
header: () => {
return <span className="text-xs">Category</span>
return <span>Category</span>
},
accessorKey: 'category',
cell: ({ row }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/AccountsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function AccountCard({ onSuccess, account }: AccountCardProps) {
account.name
)}
</p>
<p className="text-sm text-muted-foreground">
<p className="text-muted-foreground">
{account.currentBalance ? (
formatMoney(account.currentBalance)
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/TablePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function TablePage() {

return (
<>
<DataTable table={table} />
<DataTable table={table} filters={[{ column: 'account' }]} />

{Boolean(selectedRows.length) && (
<SelectionOverlay selectedRows={selectedRows} key={Math.random()} />
Expand Down
50 changes: 25 additions & 25 deletions src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from 'react'
import { cva, type VariantProps } from 'class-variance-authority'

import { cn } from "@/lib/utils"
import { cn } from '@/lib/utils'

const badgeVariants = cva(
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
'inline-flex items-center rounded-md border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
{
variants: {
variant: {
default:
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
outline: 'text-foreground',
},
},
defaultVariants: {
variant: 'default',
},
},
)

export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}

export { Badge, badgeVariants }
90 changes: 45 additions & 45 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from 'react'
import { Slot } from '@radix-ui/react-slot'
import { cva, type VariantProps } from 'class-variance-authority'

import { cn } from "@/lib/utils"
import { cn } from '@/lib/utils'

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline:
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
'inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50',
{
variants: {
variant: {
default:
'bg-primary text-primary-foreground shadow hover:bg-primary/90',
destructive:
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
outline:
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
secondary:
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline',
},
size: {
default: 'h-9 px-4 py-2',
sm: 'h-8 rounded-md px-3',
lg: 'h-10 rounded-md px-8',
icon: 'h-9 w-9',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
},
)

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : 'button'
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
},
)
Button.displayName = "Button"
Button.displayName = 'Button'

export { Button, buttonVariants }
6 changes: 1 addition & 5 deletions src/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
<p ref={ref} className={cn('text-muted-foreground', className)} {...props} />
))
CardDescription.displayName = 'CardDescription'

Expand Down
17 changes: 5 additions & 12 deletions src/components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const CommandInput = React.forwardRef<
<CommandPrimitive.Input
ref={ref}
className={cn(
'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
'flex h-10 w-full rounded-md bg-transparent py-3 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
{...props}
Expand All @@ -72,11 +72,7 @@ const CommandEmpty = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Empty>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
>((props, ref) => (
<CommandPrimitive.Empty
ref={ref}
className="py-6 text-center text-sm"
{...props}
/>
<CommandPrimitive.Empty ref={ref} className="py-6 text-center" {...props} />
))

CommandEmpty.displayName = CommandPrimitive.Empty.displayName
Expand All @@ -88,7 +84,7 @@ const CommandGroup = React.forwardRef<
<CommandPrimitive.Group
ref={ref}
className={cn(
'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-base [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
className,
)}
{...props}
Expand Down Expand Up @@ -116,7 +112,7 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
{...props}
Expand All @@ -131,10 +127,7 @@ const CommandShortcut = ({
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn(
'ml-auto text-xs tracking-widest text-muted-foreground',
className,
)}
className={cn('ml-auto tracking-widest text-muted-foreground', className)}
{...props}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/data-table/data-table-faceted-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function DataTableFacetedFilter<TData, TValue>({
)}
<span>{option.label}</span>
{facets?.get(option.value) && (
<span className="ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs">
<span className="ml-auto flex h-4 w-4 items-center justify-center font-monos">
{facets.get(option.value)}
</span>
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/data-table/data-table-pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export function DataTablePagination<TData>({
}: DataTablePaginationProps<TData>) {
return (
<div className="flex items-center justify-between mx-3 mb-3">
<div className="flex-1 text-sm text-muted-foreground">
<div className="flex-1 text-muted-foreground">
{table.getFilteredSelectedRowModel().rows.length} of{' '}
{table.getFilteredRowModel().rows.length} row(s) selected.
</div>
<div className="flex items-center space-x-6 lg:space-x-8">
<div className="flex items-center space-x-2">
<p className="text-sm font-medium">Rows per page</p>
<p className="font-medium">Rows per page</p>
<Select
value={`${table.getState().pagination.pageSize}`}
onValueChange={(value) => {
Expand All @@ -49,7 +49,7 @@ export function DataTablePagination<TData>({
</SelectContent>
</Select>
</div>
<div className="flex w-[100px] items-center justify-center text-sm font-medium">
<div className="flex w-[100px] items-center justify-center font-medium">
Page {table.getState().pagination.pageIndex + 1} of{' '}
{table.getPageCount()}
</div>
Expand Down
21 changes: 17 additions & 4 deletions src/components/ui/data-table/data-table-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ import { Table } from '@tanstack/react-table'

import { Input } from '@/components/ui/input'
import { DataTableViewOptions } from './data-table-view-options'
import { DataTableFacetedFilter } from './data-table-faceted-filter'
import { Button } from '../button'
import { Cross2Icon } from '@radix-ui/react-icons'

interface DataTableToolbarProps<TData> {
table: Table<TData>
filters?: { column: keyof TData }[]
}

export function DataTableToolbar<TData>({
table,
filters,
}: DataTableToolbarProps<TData>) {
// const isFiltered = table.getState().columnFilters.length > 0
const isFiltered = table.getState().columnFilters.length > 0

return (
<div className="flex items-center justify-between m-3">
Expand All @@ -25,6 +30,14 @@ export function DataTableToolbar<TData>({
}
className="h-8 w-[150px] lg:w-[250px]"
/>
{filters?.map((filter) => (
<DataTableFacetedFilter
column={table.getColumn(filter.column as string)}
title="Merchant"
options={[{ label: 'test', value: 'test' }]}
/>
))}

{/* {table.getColumn('merchantName') && (
<DataTableFacetedFilter
column={table.getColumn('merchantName')}
Expand All @@ -38,17 +51,17 @@ export function DataTableToolbar<TData>({
title="Date"
options={priorities}
/>
)}
)} */}
{isFiltered && (
<Button
variant="ghost"
variant="outline"
onClick={() => table.resetColumnFilters()}
className="h-8 px-2 lg:px-3"
>
Reset
<Cross2Icon className="ml-2 h-4 w-4" />
</Button>
)} */}
)}
</div>
<DataTableViewOptions table={table} />
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/components/ui/data-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import { DataTableToolbar } from './data-table-toolbar'

interface DataTableProps<TData> {
table: Table<TData>
filters?: { column: keyof TData }[]
}

export function DataTable<TData>({ table }: DataTableProps<TData>) {
export function DataTable<TData>({ table, filters }: DataTableProps<TData>) {
return (
<>
<DataTableToolbar table={table} />
<DataTableToolbar table={table} filters={filters} />

<div className="rounded-md border overflow-auto mx-3 mb-3">
<UITable>
<TableHeader>
Expand Down
Loading

0 comments on commit 3e42c26

Please sign in to comment.