-
Notifications
You must be signed in to change notification settings - Fork 0
[Ui/#13] 공통 컴포넌트 제작 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c697102
setting: husky pre-commit에 npx 경로(PATH) 보정 추가
yewon20804 6a206ee
design: fab용 그림자 상수 추가 및 아이콘 xl 사이즈 추가
yewon20804 d06a004
ui: fab 플로팅 버튼 컴포넌트 추가
yewon20804 6241f36
design: 아이콘 xl(28px) 사이즈 추가 및 기존 xl(32px)은 2xl로 정리
yewon20804 816ea10
asset: 채택 로고 이미지 추가
yewon20804 e2e6073
ui: 상단 앱바 헤더 컴포넌 및 스토리북 추가
yewon20804 036f9f2
setting: storybook 프리뷰에 backgrounds 옵션 추가
yewon20804 4b42166
ui: 아이콘 버튼 공용 컴포넌트 및 스토리북 추가
yewon20804 cade66e
ui: 버튼 공용 컴포넌트 및 스토리북 추가
yewon20804 fd4d3ee
ui: 헤더 스토리에 전체 상태 스토리 추가
yewon20804 1b07a7e
ui: home 화면에 공용 button 적용 및 임시 button 컴포넌트 정리
yewon20804 e86c5db
ui: 아이콘 버튼 기본 너비 w-full로 지정
yewon20804 68c02d0
fix: onPress 없을 때 accessibilityRole 조건부 처리
yewon20804 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 +1,3 @@ | ||
| export PATH="/usr/local/bin:$PATH" | ||
|
|
||
| npx lint-staged |
This file contains hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,72 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-native-web-vite"; | ||
| import { View } from "react-native"; | ||
|
|
||
| import { Button } from "./Button"; | ||
|
|
||
| const meta = { | ||
| title: "Common/Button", | ||
| component: Button, | ||
| parameters: { layout: "centered" }, | ||
| tags: ["autodocs"], | ||
| argTypes: { | ||
| variant: { | ||
| control: "inline-radio", | ||
| options: ["blue", "gray", "outline", "white"], | ||
| }, | ||
| size: { | ||
| control: "inline-radio", | ||
| options: ["tiny", "sm", "modal", "lg", "xl"], | ||
| }, | ||
| }, | ||
| args: { | ||
| label: "label", | ||
| }, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <View className="w-[358px]"> | ||
| <Story /> | ||
| </View> | ||
| ), | ||
| ], | ||
| } satisfies Meta<typeof Button>; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Blue: Story = {}; | ||
|
|
||
| export const Gray: Story = { | ||
| args: { variant: "gray" }, | ||
| }; | ||
|
|
||
| export const Outline: Story = { | ||
| args: { variant: "outline" }, | ||
| }; | ||
|
|
||
| export const White: Story = { | ||
| args: { variant: "white", size: "xl" }, | ||
| }; | ||
|
|
||
| export const Disabled: Story = { | ||
| args: { disabled: true }, | ||
| }; | ||
|
|
||
| export const All: Story = { | ||
| render: (args) => ( | ||
| <View className="gap-3"> | ||
| <Button {...args} size="tiny" variant="outline" className="self-start" /> | ||
| <View className="flex-row gap-3"> | ||
| <Button {...args} size="sm" /> | ||
| <Button {...args} size="sm" variant="outline" /> | ||
| <Button {...args} size="sm" variant="gray" /> | ||
| </View> | ||
| <Button {...args} size="modal" /> | ||
| <Button {...args} size="modal" variant="gray" /> | ||
| <Button {...args} size="lg" /> | ||
| <Button {...args} size="lg" variant="gray" /> | ||
| <Button {...args} size="xl" /> | ||
| <Button {...args} size="xl" variant="white" /> | ||
| </View> | ||
| ), | ||
| }; |
This file contains hidden or 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,79 @@ | ||
| import { Pressable, Text } from "react-native"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| export type ButtonStyle = "blue" | "gray" | "outline" | "white"; | ||
| export type ButtonSize = "tiny" | "sm" | "modal" | "lg" | "xl"; | ||
|
|
||
| const VARIANT_CLASS: Record<ButtonStyle, string> = { | ||
| blue: "bg-primary", | ||
| gray: "bg-gray-100", | ||
| outline: "border border-primary bg-bg", | ||
| // white는 xl 전용 색상 | ||
| white: "bg-gray-0", | ||
| }; | ||
|
|
||
| const VARIANT_TEXT_CLASS: Record<ButtonStyle, string> = { | ||
| blue: "text-gray-0", | ||
| gray: "text-gray-600", | ||
| outline: "text-primary", | ||
| white: "text-gray-600", | ||
| }; | ||
|
|
||
| const SIZE_CLASS: Record<ButtonSize, string> = { | ||
| tiny: "w-auto rounded-full px-3 py-1.5", | ||
| sm: "w-[84px] rounded py-2", | ||
| modal: "h-11 rounded-lg p-2.5", | ||
| lg: "h-12 rounded-lg p-2.5", | ||
| xl: "h-12 p-2.5", | ||
| }; | ||
|
|
||
| const SIZE_TEXT_CLASS: Record<ButtonSize, string> = { | ||
| tiny: "text-b-04-m", | ||
| sm: "text-b-04-m", | ||
| modal: "text-b-02-m", | ||
| lg: "text-btn", | ||
| xl: "text-btn", | ||
| }; | ||
|
|
||
| export type ButtonProps = { | ||
| label: string; | ||
| variant?: ButtonStyle; | ||
| size?: ButtonSize; | ||
| onPress?: () => void; | ||
| disabled?: boolean; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function Button({ | ||
| label, | ||
| variant = "blue", | ||
| size = "lg", | ||
| onPress, | ||
| disabled = false, | ||
| className, | ||
| }: ButtonProps) { | ||
| return ( | ||
| <Pressable | ||
| accessibilityRole={onPress ? "button" : undefined} | ||
| accessibilityState={{ disabled }} | ||
| disabled={disabled} | ||
| onPress={onPress} | ||
| className={cn( | ||
| "w-full items-center justify-center", | ||
| SIZE_CLASS[size], | ||
| disabled ? "bg-gray-200" : VARIANT_CLASS[variant], | ||
| className | ||
| )} | ||
| > | ||
| <Text | ||
| className={cn( | ||
| disabled ? "text-gray-400" : VARIANT_TEXT_CLASS[variant], | ||
| SIZE_TEXT_CLASS[size] | ||
| )} | ||
| > | ||
| {label} | ||
| </Text> | ||
| </Pressable> | ||
| ); | ||
| } |
This file contains hidden or 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,31 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-native-web-vite"; | ||
| import { View } from "react-native"; | ||
|
|
||
| import { Fab } from "./Fab"; | ||
|
|
||
| const meta = { | ||
| title: "Common/Fab", | ||
| component: Fab, | ||
| parameters: { layout: "centered" }, | ||
| tags: ["autodocs"], | ||
| argTypes: { | ||
| defaultOpen: { control: "boolean" }, | ||
| }, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <View pointerEvents="none"> | ||
| <Story /> | ||
| </View> | ||
| ), | ||
| ], | ||
| } satisfies Meta<typeof Fab>; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; | ||
|
|
||
| export const Open: Story = { | ||
| args: { defaultOpen: true }, | ||
| }; | ||
This file contains hidden or 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,79 @@ | ||
| import { useState } from "react"; | ||
| import { Pressable, Text, View } from "react-native"; | ||
|
|
||
| import { Add, Cancel, TaskGenerate, TaskJoin } from "@/components/icons"; | ||
| import { FAB_PRIMARY_SHADOW, FAB_SECONDARY_SHADOW } from "@/constants/shadows"; | ||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| export type FabProps = { | ||
| onCreateTask?: () => void; | ||
| onJoinTeamTask?: () => void; | ||
| defaultOpen?: boolean; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function Fab({ | ||
| onCreateTask, | ||
| onJoinTeamTask, | ||
| defaultOpen = false, | ||
| className, | ||
| }: FabProps) { | ||
| const [isOpen, setIsOpen] = useState(defaultOpen); | ||
|
|
||
| function handleCreateTask() { | ||
| setIsOpen(false); | ||
| onCreateTask?.(); | ||
| } | ||
|
|
||
| function handleJoinTeamTask() { | ||
| setIsOpen(false); | ||
| onJoinTeamTask?.(); | ||
| } | ||
|
|
||
| return ( | ||
| <View className={cn("items-end gap-3", className)}> | ||
| {isOpen ? ( | ||
| <> | ||
| <View className="flex-row items-center gap-4"> | ||
| <Text className="text-gray-0 text-b-01-m">새 과제 생성</Text> | ||
| <Pressable | ||
| accessibilityRole="button" | ||
| accessibilityLabel="새 과제 생성" | ||
| onPress={handleCreateTask} | ||
| style={FAB_SECONDARY_SHADOW} | ||
| className="size-[60px] items-center justify-center rounded-full bg-gray-100" | ||
| > | ||
| <TaskGenerate variant="2xl" className="text-gray-800" /> | ||
| </Pressable> | ||
| </View> | ||
| <View className="flex-row items-center gap-4"> | ||
| <Text className="text-gray-0 text-b-01-m">팀 과제 참여</Text> | ||
| <Pressable | ||
| accessibilityRole="button" | ||
| accessibilityLabel="팀 과제 참여" | ||
| onPress={handleJoinTeamTask} | ||
| style={FAB_SECONDARY_SHADOW} | ||
| className="size-[60px] items-center justify-center rounded-full bg-gray-100" | ||
| > | ||
| <TaskJoin variant="2xl" className="text-gray-800" /> | ||
| </Pressable> | ||
| </View> | ||
| </> | ||
| ) : null} | ||
|
|
||
| <Pressable | ||
| accessibilityRole="button" | ||
| accessibilityLabel={isOpen ? "닫기" : "새 과제 만들기"} | ||
| onPress={() => setIsOpen((prev) => !prev)} | ||
| style={FAB_PRIMARY_SHADOW} | ||
| className="size-[60px] items-center justify-center rounded-full bg-blue-500" | ||
| > | ||
| {isOpen ? ( | ||
| <Cancel variant="2xl" className="text-primary-button-text" /> | ||
| ) : ( | ||
| <Add variant="2xl" className="text-primary-button-text" /> | ||
| )} | ||
| </Pressable> | ||
| </View> | ||
| ); | ||
| } |
This file contains hidden or 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 { Pressable, Text } from "react-native"; | ||
|
|
||
| import { Left } from "@/components/icons"; | ||
|
|
||
| import { HeaderContainer } from "./HeaderContainer"; | ||
|
|
||
| export type BackHeaderProps = { | ||
| label?: string; | ||
| onBack?: () => void; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function BackHeader({ label, onBack, className }: BackHeaderProps) { | ||
| return ( | ||
| <HeaderContainer className={className}> | ||
| <Pressable | ||
| accessibilityRole={onBack ? "button" : undefined} | ||
| accessibilityLabel="뒤로가기" | ||
| onPress={onBack} | ||
| hitSlop={8} | ||
| className="flex-row items-center gap-1" | ||
| > | ||
| <Left variant="lg" className="text-gray-800" /> | ||
| {label ? ( | ||
| <Text className="text-gray-800 text-b-01-m">{label}</Text> | ||
| ) : null} | ||
| </Pressable> | ||
| </HeaderContainer> | ||
| ); | ||
| } |
This file contains hidden or 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,26 @@ | ||
| import { Pressable } from "react-native"; | ||
|
|
||
| import { Cancel } from "@/components/icons"; | ||
|
|
||
| import { HeaderContainer } from "./HeaderContainer"; | ||
|
|
||
| export type CloseHeaderProps = { | ||
| onClose?: () => void; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function CloseHeader({ onClose, className }: CloseHeaderProps) { | ||
| return ( | ||
| <HeaderContainer className={className}> | ||
| <Pressable | ||
| accessibilityRole={onClose ? "button" : undefined} | ||
| accessibilityLabel="닫기" | ||
| onPress={onClose} | ||
| hitSlop={8} | ||
| className="ml-auto" | ||
| > | ||
| <Cancel variant="xl" color="text-gray-800" /> | ||
| </Pressable> | ||
| </HeaderContainer> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: check-task/mobile-frontend
Length of output: 4610
🏁 Script executed:
Repository: check-task/mobile-frontend
Length of output: 11438
🌐 Web query:
React Native View pointerEvents="none" children touch events react-native-web documentation💡 Result:
In React Native and React Native for Web, the pointerEvents prop on a View component determines how that view and its children respond to touch events [1][2]. When you set pointerEvents="none" on a View, the View itself becomes transparent to all touch events, and crucially, all of its children are also excluded from receiving touch events [1][3]. If your goal is to make a parent View ignore touch events while allowing its children to remain interactive, you should use pointerEvents="box-none" instead [1][4]. Summary of pointerEvents values: - auto: The View and its children can be targets of touch events (default) [1]. - none: Neither the View nor its children can be targets of touch events [1][3]. - box-none: The View is never the target of touch events, but its subviews (children) can be [1][4]. - box-only: The View can be the target of touch events, but its subviews cannot be [1][3]. This behavior is consistent across both React Native and React Native for Web [2][3][5]. In the context of React Native for Web, these values are implemented by applying specific CSS pointer-events rules to the container and its children [2][6]. Note that pointerEvents is a property of the View component, not a CSS style, and must be passed as a prop [4].
Citations:
pointerEvents="none"을 제거하세요.이 설정은
Fab내부의 모든Pressable입력을 차단합니다. 제거하면 Storybook에서 FAB 토글과 보조 액션을 사용할 수 있습니다.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
보조 액션 없이 그 상태가 보이도록 하려고 추가했습니다