-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated client code and added shadcn button
- Loading branch information
1 parent
df78318
commit 0b5a9b4
Showing
19 changed files
with
1,239 additions
and
466 deletions.
There are no files selected for viewing
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 @@ | ||
18.13.0 |
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,17 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "new-york", | ||
"rsc": false, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/styles/global.css", | ||
"baseColor": "slate", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "src/components", | ||
"utils": "@utils" | ||
} | ||
} |
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,30 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe.configure({ mode: 'parallel' }) | ||
test.describe('counter', () => { | ||
test('has Heading', async ({ page }) => { | ||
await page.goto('http://localhost:4173') | ||
const text = await page.textContent('p') | ||
expect(text).toBe('Vite + React + TailwindCSS + Zustand') | ||
}) | ||
|
||
test('has zero', async ({ page }) => { | ||
await page.goto('http://localhost:4173') | ||
const text = await page.getByLabel('count').textContent() | ||
expect(text).toBe('0') | ||
}) | ||
|
||
test('increments', async ({ page }) => { | ||
await page.goto('http://localhost:4173') | ||
await page.getByLabel('increment').click() | ||
const text = await page.getByLabel('count').textContent() | ||
expect(text).toBe('1') | ||
}) | ||
|
||
test('decrements', async ({ page }) => { | ||
await page.goto('http://localhost:4173') | ||
await page.getByLabel('decrement').click() | ||
const text = await page.getByLabel('count').textContent() | ||
expect(text).toBe('-1') | ||
}) | ||
}) |
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,11 +1,32 @@ | ||
import { render } from '@testing-library/react' | ||
import { act } from 'react-dom/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import App from './App' | ||
|
||
describe('App', () => { | ||
it('renders hello world', () => { | ||
it('renders heading', () => { | ||
const { getByText } = render(<App />) | ||
expect(getByText('Hello, world!👋')).toBeInTheDocument() | ||
expect( | ||
getByText('Vite + React + TailwindCSS + Zustand'), | ||
).toBeInTheDocument() | ||
}) | ||
|
||
it('renders count', () => { | ||
const { getByLabelText } = render(<App />) | ||
expect(getByLabelText('count')).toBeInTheDocument() | ||
expect(getByLabelText('count')).toHaveTextContent('0') | ||
}) | ||
|
||
it('increments and decrements count', () => { | ||
const { getByLabelText } = render(<App />) | ||
act(() => { | ||
getByLabelText('decrement').click() | ||
}) | ||
expect(getByLabelText('count')).toHaveTextContent('-1') | ||
act(() => { | ||
getByLabelText('increment').click() | ||
}) | ||
expect(getByLabelText('count')).toHaveTextContent('0') | ||
}) | ||
}) |
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,55 @@ | ||
// Button created via Shadcn UI (https://ui.shadcn.com/docs) | ||
import { Slot } from '@radix-ui/react-slot' | ||
import { cn } from '@utils/cn' | ||
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 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 active:shadow-none', | ||
destructive: | ||
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:shadow-none', | ||
outline: | ||
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/90 active:shadow-none', | ||
secondary: | ||
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:shadow-none', | ||
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', | ||
}, | ||
}, | ||
) | ||
|
||
export interface ButtonProps | ||
extends React.ButtonHTMLAttributes<HTMLButtonElement>, | ||
VariantProps<typeof buttonVariants> { | ||
asChild?: boolean | ||
} | ||
|
||
export 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' |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import './index.css' | ||
import '@styles/global.css' | ||
|
||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
|
||
import App from './App.tsx' | ||
|
||
const queryClient = new QueryClient() | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
<ReactQueryDevtools client={queryClient} position="bottom" /> | ||
</React.StrictMode>, | ||
) |
Oops, something went wrong.