Skip to content

Commit

Permalink
tailwind.config.js 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
doggopawer committed Oct 31, 2023
2 parents aa254c7 + 85eea3d commit dfa749d
Show file tree
Hide file tree
Showing 20 changed files with 316 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
NEXT_PUBLIC_API_MOCKING=enabled # or disabled
NEXT_PUBLIC_API_MOCKING=enabled # or disabled
CHROMATIC_TOKEN=your-token
20 changes: 13 additions & 7 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: 'Chromatic Deployment'
name: 'Chromatic'

on:
# 원하는 브랜치 명으로 바꿔주시면 됩니다.
push:
pull_request:
branches: ['develop']

jobs:
test:
chromatic-deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn
- uses: chromaui/action@v1
- name: Install dependencies
run: |
npm install -g pnpm
- name: Install Dependency
run: pnpm install

- name: Publish to Chromatic
uses: chromaui/action@v1

with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
"test": "vitest --run",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"chromatic": "npx chromatic --project-token=chpt_00fe989402301dc"
"chromatic": "bash ./scripts/chromatic_publish.sh"
},
"dependencies": {
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
27 changes: 27 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/images/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/kakao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/app/(root)/(routes)/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import Link from 'next/link'
import Button from '@/components/ui/Button'
import { DarkModeButton } from '@/components/ui/DarkModeButton'
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogFooter,
DialogClose,
} from '@/components/ui/Dialog'
import Input from '@/components/ui/Input'
import Label from '@/components/ui/Label'

export default function HomePage() {
return (
Expand All @@ -9,6 +21,41 @@ export default function HomePage() {
<DarkModeButton />
<Link href={'/login'}>로긴</Link>
<Button variant={'gradation'}>버튼</Button>
<Dialog>
<DialogTrigger asChild>
<Button variant="primary">Share</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-md">
<DialogHeader>
<DialogTitle>Share link</DialogTitle>
<DialogDescription>
Anyone who has this link will be able to view this.
</DialogDescription>
</DialogHeader>
<div className="flex items-center space-x-2">
<div className="grid flex-1 gap-2">
<Label htmlFor="link" className="sr-only">
Link
</Label>
<Input
id="link"
defaultValue="https://ui.shadcn.com/docs/installation"
readOnly
/>
</div>
<Button type="submit" className="px-3">
<span className="sr-only">Copy</span>
</Button>
</div>
<DialogFooter className="sm:justify-start">
<DialogClose asChild>
<Button type="button" variant="secondary">
Close
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</main>
)
}
14 changes: 11 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Suspense } from 'react'
import type { Metadata } from 'next'
import Head from 'next/head'
import Header from '@/components/domain/Header'
import { Environment } from '@/config/environment'
import TanstackQueryContext from '@/contexts/TanstackQueryContext'
import ThemeProviderContext from '@/contexts/ThemeProviderContext'
Expand All @@ -8,7 +10,7 @@ import '@/styles/globals.css'

export const metadata: Metadata = {
title: '나비장터',
description: 'Generated by create next app',
description: '물물교환 플랫폼 나비장터입니다.',
}

if (Environment.apiMocking() === 'enabled') {
Expand All @@ -25,12 +27,18 @@ export default function RootLayout({
}) {
return (
<html lang="ko">
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</Head>
<body>
<TanstackQueryContext>
<ThemeProviderContext>
<Suspense>
{children}
{authModal}
<div className="centered-content">
<Header isLogin={true} />
{children}
{authModal}
</div>
</Suspense>
</ThemeProviderContext>
</TanstackQueryContext>
Expand Down
2 changes: 1 addition & 1 deletion src/components/domain/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type HeaderProps = {

const Header = ({ isLogin = false }: HeaderProps) => {
return (
<header className="grid items-center justify-between w-full grid-cols-3 px-2 h-14 shadow-bottom bg-background-color">
<header className="absolute top-0 left-0 z-10 grid items-center justify-between w-full grid-cols-3 px-2 h-nav shadow-bottom bg-background-color">
<div className="flex items-center justify-start">
<MenuButton />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Meta, StoryObj } from '@storybook/react'
import { KakaoLoginButton, GoogleLoginButton } from './LoginButtons'

const meta = {
title: 'DOMAIN/LoginButtons',
component: KakaoLoginButton,
tags: ['autodocs'],
argTypes: {},
} satisfies Meta<typeof KakaoLoginButton>

export default meta
type Story = StoryObj<typeof meta>

export const Normal: Story = {
args: {},
render: () => (
<section className="flex flex-col gap-3">
<KakaoLoginButton onClickButton={() => alert('카카오 버튼')} />
<GoogleLoginButton onClickButton={() => alert('구글 버튼')} />
</section>
),
}

export const Kakao: Story = {
render: () => <KakaoLoginButton onClickButton={() => alert('카카오 버튼')} />,
}

export const Google: Story = {
render: () => <GoogleLoginButton onClickButton={() => alert('구글 버튼')} />,
}
42 changes: 42 additions & 0 deletions src/components/domain/buttons/LoginButtons/LoginButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import Image from 'next/image'
import Button from '@/components/ui/Button'
import Assets from '@/config/assets'

const KakaoLoginButton = ({ onClickButton }: { onClickButton: () => void }) => {
return (
<Button
onClick={onClickButton}
className="relative h-10 text-black transition-all bg-kakao-color hover:brightness-90 w-80 hover:bg-kakao-color"
>
<Image
className="absolute flex-shrink-0 left-3"
src={Assets.kakaoIcon}
alt="카카오 로그인"
/>
카카오 계정으로 시작하기
</Button>
)
}

const GoogleLoginButton = ({
onClickButton,
}: {
onClickButton: () => void
}) => {
return (
<Button
onClick={onClickButton}
className="relative h-10 text-black transition-all bg-white border border-gray hover:brightness-90 w-80 hover:bg-white"
>
<Image
className="absolute flex-shrink-0 left-3"
src={Assets.googleIcon}
alt="구글 로그인"
/>
구글 계정으로 시작하기
</Button>
)
}

export { KakaoLoginButton, GoogleLoginButton }
3 changes: 3 additions & 0 deletions src/components/domain/buttons/LoginButtons/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { KakaoLoginButton, GoogleLoginButton } from './LoginButtons'

export { KakaoLoginButton, GoogleLoginButton }
34 changes: 34 additions & 0 deletions src/components/ui/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Meta, StoryObj } from '@storybook/react'
import { Avatar, AvatarImage, AvatarFallback } from './Avatar'

const meta = {
title: 'UI/Avatar',
component: Avatar,
tags: ['autodocs'],
argTypes: {},
} satisfies Meta<typeof Avatar>

export default meta
type Story = StoryObj<typeof meta>

export const Normal: Story = {
args: {},
render: () => {
return (
<>
<Avatar size="sm">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>NB</AvatarFallback>
</Avatar>
<Avatar size="md">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>NB</AvatarFallback>
</Avatar>
<Avatar size="lg">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>NB</AvatarFallback>
</Avatar>
</>
)
},
}
67 changes: 67 additions & 0 deletions src/components/ui/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use client'

import * as React from 'react'
import * as AvatarPrimitive from '@radix-ui/react-avatar'
import { cva, type VariantProps } from 'class-variance-authority'
import { cn } from '@/utils'

const avatarVariants = cva(
'relative flex shrink-0 overflow-hidden rounded-full',
{
variants: {
size: {
sm: 'w-6 h-6',
md: 'w-10 h-10',
lg: 'w-[100px] h-[100px]',
},
},
},
)

export interface AvatarProps
extends React.HTMLAttributes<HTMLSpanElement>,
VariantProps<typeof avatarVariants> {
ref?: React.Ref<HTMLSpanElement>
}

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> &
VariantProps<typeof avatarVariants>
>(({ className, size, ...props }: AvatarProps, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(avatarVariants({ size }), className)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn('aspect-square h-full w-full', className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
'flex h-full w-full items-center justify-center rounded-full ',
className,
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName

export { Avatar, AvatarImage, AvatarFallback }
3 changes: 3 additions & 0 deletions src/components/ui/Avatar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Avatar, AvatarImage, AvatarFallback } from './Avatar'

export { Avatar, AvatarImage, AvatarFallback }
2 changes: 1 addition & 1 deletion src/components/ui/DropdownMenu/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-background-color p-1 text-text-color shadow-md',
'z-50 absolute min-w-[8rem] overflow-hidden rounded-md border bg-background-color p-1 text-text-color shadow-md',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className,
)}
Expand Down
Loading

0 comments on commit dfa749d

Please sign in to comment.