Skip to content

Commit

Permalink
모바일 환경에서 StarRatingInput 호버 문제 수정 (#550)
Browse files Browse the repository at this point in the history
* refactor: 디자인시스템 1.3.0 버전업

* refactor: 모바일 환경에서 StarRatingInput 호버 문제 수정
  • Loading branch information
dladncks1217 authored Sep 11, 2023
1 parent 72933a0 commit 8645b1a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
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}
/>
);
},
};

0 comments on commit 8645b1a

Please sign in to comment.