Skip to content

Commit

Permalink
feat: dowgrade react 18
Browse files Browse the repository at this point in the history
  • Loading branch information
khoilen committed Jan 22, 2025
1 parent 0e18218 commit e210e08
Show file tree
Hide file tree
Showing 8 changed files with 1,099 additions and 1,221 deletions.
14 changes: 1 addition & 13 deletions apps/nt-headless-ui/components/ui/avatar/avatar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ import { describe, expect, it } from 'vitest'

import { Avatar } from './avatar'

describe('Avatar', () => {
it('renders with image source and fallback', () => {
render(<Avatar src="/images/test-avatar.jpg" fallBack="JD" />)
const image = screen.getByRole('img')
const fallback = screen.queryByText('JD')

expect(image).toHaveAttribute(
'src',
'/images/test-avatar.jpg',
)
expect(fallback).not.toBeInTheDocument()
})

describe('Avatar ', () => {
it('renders fallback content when image source is not provided', () => {
render(<Avatar fallBack="NA" />)
const fallback = screen.getByText('NA')
Expand Down
5 changes: 2 additions & 3 deletions apps/nt-headless-ui/components/ui/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AvatarImage = React.forwardRef<
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
alt="img"
className={cn(
'aspect-square h-full w-full rounded-full',
className,
Expand Down Expand Up @@ -72,9 +73,7 @@ const Avatar = (props: AvatarProps) => {
return (
<AvatarPrimitiveRoot {...args}>
<AvatarImage src={src} />
<AvatarFallback>
{fallBack ? fallBack : null}
</AvatarFallback>
<AvatarFallback>{fallBack || null}</AvatarFallback>
{badge && (
<span
className={cn(
Expand Down
1 change: 0 additions & 1 deletion apps/nt-headless-ui/components/ui/badge/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { cn } from '@/lib/utils'
import { cva, VariantProps } from 'class-variance-authority'
import React from 'react'

const badgeVariants = cva(
'inline-flex items-center hover:cursor-pointer px-2.5 py-1.5',
Expand Down
11 changes: 6 additions & 5 deletions apps/nt-headless-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,29 @@
"test": "pnpm vitest"
},
"dependencies": {
"@radix-ui/react-avatar": "^1.1.2",
"@testing-library/react": "^16.2.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"eslint-config-next": "^15.1.4",
"next": "15.1.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwind-merge": "^2.6.0",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@chromatic-com/storybook": "^3",
"@radix-ui/react-avatar": "^1.1.2",
"@storybook/addon-actions": "^8.4.7",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/nextjs": "^8.4.7",
"@storybook/react": "^8.4.7",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"autoprefixer": "^10.4.20",
"typescript": "^5",
"webpack": "5"
Expand Down
Loading

0 comments on commit e210e08

Please sign in to comment.