Skip to content
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

모바일 환경에서 StarRatingInput 호버 문제 수정 #550

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@tanstack/react-query": "^4.29.19",
"axios": "^1.4.0",
"dotenv": "^16.3.1",
"hang-log-design-system": "^1.3.0",
"hang-log-design-system": "^1.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.14.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import type { StarRatingData, TripItemFormData } from '@type/tripItem';

interface StarRatingInputProps {
rating: StarRatingData | null;
isMobile: boolean;
updateInputValue: <K extends keyof TripItemFormData>(key: K, value: TripItemFormData[K]) => void;
}

const StarRatingInput = ({ rating, updateInputValue }: StarRatingInputProps) => {
const StarRatingInput = ({ rating, isMobile, updateInputValue }: StarRatingInputProps) => {
const handleRatingChange = (rate: StarRatingData) => {
const newRate = rate || null;
updateInputValue('rating', newRate);
Expand All @@ -22,6 +23,7 @@ const StarRatingInput = ({ rating, updateInputValue }: StarRatingInputProps) =>

return (
<StarRating
isMobile={isMobile}
label="별점"
size={32}
gap={8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const TripItemAddModal = ({
<StarRatingInput
rating={tripItemInformation.rating}
updateInputValue={updateInputValue}
isMobile={isMobile}
/>
<ExpenseInput
initialExpenseValue={tripItemInformation.expense}
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/stories/trip/StarRatingInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const meta = {
component: StarRatingInput,
args: {
rating: 0,
isMobile: false,
},
} satisfies Meta<typeof StarRatingInput>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
render: () => {
render: ({ ...args }) => {
const [value, setValue] = useState<StarRatingData>(0);

const updateInputValue = <K extends keyof TripItemFormData>(
Expand All @@ -28,6 +29,12 @@ export const Default: Story = {
setValue(value as StarRatingData);
};

return <StarRatingInput rating={value} updateInputValue={updateInputValue} />;
return (
<StarRatingInput
isMobile={args.isMobile}
rating={value}
updateInputValue={updateInputValue}
/>
);
},
};