-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
design: 충전소 간단 정보창 상세보기 버튼 모바일에서만 보이도록 개선한다 (#748)
* design: 충전소 간단 정보창 상세보기 버튼 모바일에서만 보이도록 개선 - 충전소 간단 정보창 버튼 컴포넌트 분리 [#747] * test: `autodocs` 삭제 [#747]
- Loading branch information
Showing
6 changed files
with
125 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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 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
40 changes: 40 additions & 0 deletions
40
frontend/src/components/ui/StationSummaryWindow/SummaryButtons.stories.tsx
This file contains 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,40 @@ | ||
import type { Meta } from '@storybook/react'; | ||
import styled from 'styled-components'; | ||
|
||
import type { SummaryButtonsProps } from './SummaryButtons'; | ||
import SummaryButtons from './SummaryButtons'; | ||
|
||
const meta = { | ||
title: 'UI/StationSummaryWindow/Buttons', | ||
component: SummaryButtons, | ||
args: { | ||
handleCloseStationSummary: () => { | ||
alert('충전소 간단 정보창이 닫혔습니다.'); | ||
}, | ||
handleOpenStationDetail: () => { | ||
alert('충전소 상세 정보창이 열렸습니다.'); | ||
}, | ||
}, | ||
argTypes: { | ||
handleCloseStationSummary: { | ||
description: '충전소 간단 정보창을 닫을 수 있습니다.', | ||
}, | ||
handleOpenStationDetail: { | ||
description: '충전소 상세 정보창을 열 수 있습니다. 모바일에서만 보이는 버튼입니다.', | ||
}, | ||
}, | ||
} satisfies Meta<typeof SummaryButtons>; | ||
|
||
export default meta; | ||
|
||
export const Default = (args: SummaryButtonsProps) => { | ||
return ( | ||
<Container> | ||
<SummaryButtons {...args} /> | ||
</Container> | ||
); | ||
}; | ||
|
||
const Container = styled.div` | ||
width: 32rem; | ||
`; |
66 changes: 66 additions & 0 deletions
66
frontend/src/components/ui/StationSummaryWindow/SummaryButtons.tsx
This file contains 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,66 @@ | ||
import { css } from 'styled-components'; | ||
|
||
import type { MouseEvent } from 'react'; | ||
|
||
import useMediaQueries from '@hooks/useMediaQueries'; | ||
|
||
import ButtonNext from '@common/ButtonNext'; | ||
import FlexBox from '@common/FlexBox'; | ||
|
||
import { MOBILE_BREAKPOINT } from '@constants'; | ||
|
||
export interface SummaryButtonsProps { | ||
handleCloseStationSummary: (event: MouseEvent<HTMLButtonElement>) => void; | ||
handleOpenStationDetail: () => void; | ||
} | ||
|
||
const SummaryButtons = ({ | ||
handleCloseStationSummary, | ||
handleOpenStationDetail, | ||
}: SummaryButtonsProps) => { | ||
const screen = useMediaQueries(); | ||
|
||
return ( | ||
<FlexBox | ||
nowrap | ||
direction="row" | ||
justifyContent="between" | ||
mt={2.5} | ||
mb={screen.get('isMobile') ? 1 : 0} | ||
> | ||
<ButtonNext | ||
variant="outlined" | ||
size="xs" | ||
color="secondary" | ||
css={closeButtonCss} | ||
onClick={handleCloseStationSummary} | ||
> | ||
닫기 | ||
</ButtonNext> | ||
{screen.get('isMobile') && ( | ||
<ButtonNext | ||
variant="contained" | ||
size="xs" | ||
color="dark" | ||
css={{ width: '68%' }} | ||
onClick={handleOpenStationDetail} | ||
> | ||
상세보기 | ||
</ButtonNext> | ||
)} | ||
</FlexBox> | ||
); | ||
}; | ||
|
||
const closeButtonCss = css` | ||
width: 20%; | ||
margin-left: auto; | ||
border-color: #4d5053bf; | ||
@media screen and (max-width: ${MOBILE_BREAKPOINT}px) { | ||
width: 28%; | ||
margin-left: 0; | ||
} | ||
`; | ||
|
||
export default SummaryButtons; |
This file contains 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,3 @@ | ||
import StationSummaryWindow from './StationSummaryWindow'; | ||
|
||
export default StationSummaryWindow; |
This file contains 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