-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/website): render shadcn component from lib
- Loading branch information
1 parent
193bb42
commit 8784418
Showing
13 changed files
with
303 additions
and
940 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
import type { MetaFunction } from '@netlify/remix-runtime' | ||
import NxWelcome from '../nx-welcome' | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from '@shadcn/ui/accordion' | ||
import { Calendar } from '@shadcn/ui/calendar' | ||
|
||
import { useState } from 'react' | ||
|
||
export const meta: MetaFunction = () => { | ||
return [ | ||
{ title: 'cuHacking 2025' }, | ||
{ name: 'description', content: 'Carleton University\'s Official Hackathon.' }, | ||
] | ||
} | ||
|
||
export default function Index() { | ||
const [date, setDate] = useState<Date | undefined>(new Date()) | ||
|
||
return ( | ||
<div> | ||
<NxWelcome title="Website" /> | ||
<div className="container mx-auto flex justify-center"> | ||
<div className="max-w-lg"> | ||
<Calendar | ||
mode="single" | ||
selected={date} | ||
onSelect={setDate} | ||
className="rounded-md border shadow" | ||
/> | ||
|
||
<Accordion type="single" collapsible> | ||
<AccordionItem value="item-1"> | ||
<AccordionTrigger>Is it accessible?</AccordionTrigger> | ||
<AccordionContent> | ||
Yes. It adheres to the WAI-ARIA design pattern. | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
</div> | ||
</div> | ||
) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { cn } from '@cuhacking/utils' | ||
import * as AccordionPrimitive from '@radix-ui/react-accordion' | ||
import { ChevronDown } from 'lucide-react' | ||
|
||
import * as React from 'react' | ||
|
||
const Accordion = AccordionPrimitive.Root | ||
|
||
const AccordionItem = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Item>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> | ||
>(({ className, ...props }, ref) => ( | ||
<AccordionPrimitive.Item | ||
ref={ref} | ||
className={cn('border-b', className)} | ||
{...props} | ||
/> | ||
)) | ||
AccordionItem.displayName = 'AccordionItem' | ||
|
||
const AccordionTrigger = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Trigger>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> | ||
>(({ className, children, ...props }, ref) => ( | ||
<AccordionPrimitive.Header className="flex"> | ||
<AccordionPrimitive.Trigger | ||
ref={ref} | ||
className={cn( | ||
'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180', | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" /> | ||
</AccordionPrimitive.Trigger> | ||
</AccordionPrimitive.Header> | ||
)) | ||
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName | ||
|
||
const AccordionContent = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> | ||
>(({ className, children, ...props }, ref) => ( | ||
<AccordionPrimitive.Content | ||
ref={ref} | ||
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" | ||
{...props} | ||
> | ||
<div className={cn('pb-4 pt-0', className)}>{children}</div> | ||
</AccordionPrimitive.Content> | ||
)) | ||
|
||
AccordionContent.displayName = AccordionPrimitive.Content.displayName | ||
|
||
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { cn } from '@cuhacking/utils' | ||
import { Slot } from '@radix-ui/react-slot' | ||
import { cva, type VariantProps } from 'class-variance-authority' | ||
|
||
import * as React from 'react' | ||
|
||
const buttonVariants = cva( | ||
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', | ||
{ | ||
variants: { | ||
variant: { | ||
default: 'bg-primary text-primary-foreground hover:bg-primary/90', | ||
destructive: | ||
'bg-destructive text-destructive-foreground hover:bg-destructive/90', | ||
outline: | ||
'border border-input bg-background hover:bg-accent hover:text-accent-foreground', | ||
secondary: | ||
'bg-secondary text-secondary-foreground hover:bg-secondary/80', | ||
ghost: 'hover:bg-accent hover:text-accent-foreground', | ||
link: 'text-primary underline-offset-4 hover:underline', | ||
}, | ||
size: { | ||
default: 'h-10 px-4 py-2', | ||
sm: 'h-9 rounded-md px-3', | ||
lg: 'h-11 rounded-md px-8', | ||
icon: 'h-10 w-10', | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'default', | ||
size: 'default', | ||
}, | ||
}, | ||
) | ||
|
||
export interface ButtonProps | ||
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} | ||
/> | ||
) | ||
}, | ||
) | ||
Button.displayName = 'Button' | ||
|
||
export { Button, buttonVariants } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { cn } from '@cuhacking/utils' | ||
import { buttonVariants } from '@shadcn/ui/button' | ||
import { ChevronLeft, ChevronRight } from 'lucide-react' | ||
|
||
import * as React from 'react' | ||
import { DayPicker } from 'react-day-picker' | ||
|
||
export type CalendarProps = React.ComponentProps<typeof DayPicker> | ||
|
||
function Calendar({ | ||
className, | ||
classNames, | ||
showOutsideDays = true, | ||
...props | ||
}: CalendarProps) { | ||
return ( | ||
<DayPicker | ||
showOutsideDays={showOutsideDays} | ||
className={cn('p-3', className)} | ||
classNames={{ | ||
months: 'flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0', | ||
month: 'space-y-4', | ||
caption: 'flex justify-center pt-1 relative items-center', | ||
caption_label: 'text-sm font-medium', | ||
nav: 'space-x-1 flex items-center', | ||
nav_button: cn( | ||
buttonVariants({ variant: 'outline' }), | ||
'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100', | ||
), | ||
nav_button_previous: 'absolute left-1', | ||
nav_button_next: 'absolute right-1', | ||
table: 'w-full border-collapse space-y-1', | ||
head_row: 'flex', | ||
head_cell: | ||
'text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]', | ||
row: 'flex w-full mt-2', | ||
cell: 'h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20', | ||
day: cn( | ||
buttonVariants({ variant: 'ghost' }), | ||
'h-9 w-9 p-0 font-normal aria-selected:opacity-100', | ||
), | ||
day_range_end: 'day-range-end', | ||
day_selected: | ||
'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground', | ||
day_today: 'bg-accent text-accent-foreground', | ||
day_outside: | ||
'day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30', | ||
day_disabled: 'text-muted-foreground opacity-50', | ||
day_range_middle: | ||
'aria-selected:bg-accent aria-selected:text-accent-foreground', | ||
day_hidden: 'invisible', | ||
...classNames, | ||
}} | ||
components={{ | ||
// eslint-disable-next-line react/no-nested-components, unused-imports/no-unused-vars | ||
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />, | ||
// eslint-disable-next-line react/no-nested-components, unused-imports/no-unused-vars | ||
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />, | ||
}} | ||
{...props} | ||
/> | ||
) | ||
} | ||
Calendar.displayName = 'Calendar' | ||
|
||
export { Calendar } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.