Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactor/914
Browse files Browse the repository at this point in the history
  • Loading branch information
kyw0716 committed Nov 9, 2023
2 parents d7b9e3e + 146c492 commit d625ffd
Show file tree
Hide file tree
Showing 13 changed files with 830 additions and 810 deletions.
1,338 changes: 720 additions & 618 deletions frontend/package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions frontend/src/components/common/ListItem/ListItem.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta } from '@storybook/react';
import { Box } from 'car-ffeine-design-system';

import List from '../List';
import Text from '../Text';
Expand Down Expand Up @@ -43,7 +44,7 @@ export const Default = (args: ListItemProps) => {

export const Menu = () => {
return (
<div style={{ width: '150px' }}>
<Box css={{ width: '150px' }}>
<List border>
<ListItem>
<Text variant="body">메뉴1</Text>
Expand All @@ -58,6 +59,6 @@ export const Menu = () => {
<Text variant="body">로그아웃</Text>
</ListItem>
</List>
</div>
</Box>
);
};
2 changes: 1 addition & 1 deletion frontend/src/components/common/Tab/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Menu = ({ label, icon, index, iconPosition = 'left', onClick, ...attribute
role="tab"
id={`${id}-tab-${index}`}
aria-controls={`${id}-panel-${index}`}
aria-selected={activeTab === `menu-${index}` ? true : false}
aria-selected={activeTab === `menu-${index}`}
className={activeTab === `menu-${index}` ? 'active' : ''}
title={label}
icon={icon}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const RegionMarker = ({ count, regionName }: RegionMarkerProps) => {
alignItems="center"
gap={1}
p={1}
style={{
css={{
background: '#fff',
borderRadius: '8px',
border: '1px solid #2a6cd8',
Expand Down
11 changes: 3 additions & 8 deletions frontend/src/components/ui/Navigator/NavigationBar/BasePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
import { Box } from 'car-ffeine-design-system';
import { css } from 'styled-components';

import type { ReactElement } from 'react';

import FlexBox from '@common/FlexBox';

import { MOBILE_BREAKPOINT } from '@constants';

interface Props {
component: ReactElement | null;
}

const BasePanel = ({ component }: Props) => {
return (
<FlexBox width="fit-content" css={containerCss}>
{component !== null && component}
</FlexBox>
);
return <Box css={containerCss}>{component !== null && component}</Box>;
};

const containerCss = css`
position: relative;
margin-left: 7rem;
@media screen and (max-width: ${MOBILE_BREAKPOINT}px) {
margin-left: 0;
position: absolute;
z-index: 99;
}
`;

Expand Down
12 changes: 3 additions & 9 deletions frontend/src/components/ui/Navigator/NavigationBar/LastPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import { css } from 'styled-components';
import { Box } from 'car-ffeine-design-system';

import type { ReactElement } from 'react';

import FlexBox from '@common/FlexBox';

interface Props {
component: ReactElement | null;
}

const LastPanel = ({ component }: Props) => {
return (
<FlexBox width="fit-content" css={containerCss}>
<Box position="relative" css={{ zIndex: 99 }}>
{component !== null && <>{component}</>}
</FlexBox>
</Box>
);
};

const containerCss = css`
position: relative;
`;

export default LastPanel;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChevronLeftIcon } from '@heroicons/react/24/solid';
import type { Meta } from '@storybook/react';
import { FlexBox } from 'car-ffeine-design-system';
import { styled } from 'styled-components';

import type { ReactElement } from 'react';
Expand Down Expand Up @@ -40,14 +41,14 @@ export const Default = () => {
<ChevronLeftIcon width="2.4rem" stroke="#9c9fa7" />
</Button>
</NavigationBar>
<div style={{ display: 'flex', flexDirection: 'column', position: 'fixed', right: 0 }}>
<FlexBox direction="column" position="fixed" right={0}>
<ButtonNext onClick={() => setBasePanel(<BaseContainerBlue />)}>
openBlueBasePanel
</ButtonNext>
<ButtonNext onClick={() => setBasePanel(<BaseContainerRed />)}>openRedBasePanel</ButtonNext>
<ButtonNext onClick={() => setBasePanel(<BaseContainer />)}>openWhiteBasePanel</ButtonNext>
<ButtonNext onClick={() => setLastPanel(<LastContainer />)}>openLastPanel</ButtonNext>
</div>
</FlexBox>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const useNavigationBar = () => {
};

return {
navigationBarPanel,
toggleBasePanel,
openLastPanel,
closeBasePanel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const CongestionStatistics = ({ stationId }: CongestionStatisticsProps) => {
{isError ? (
<Error
title="앗"
message="데이터를 불러오는데 실패했어요."
subMessage="잠시 후 다시 시도해주세요."
message="데이터를 불러오는데 실패했어요"
subMessage="잠시 후 다시 시도해주세요"
handleRetry={handleRetry}
minHeight={40.4}
/>
Expand Down
23 changes: 14 additions & 9 deletions frontend/src/components/ui/StationInfoWindow/StationInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Button from '@common/Button';
import FlexBox from '@common/FlexBox';
import Text from '@common/Text';

import { useNavigationBar } from '@ui/Navigator/NavigationBar/hooks/useNavigationBar';

import type { StationDetails } from '@type';

import PathFinding from './PathFinding';
Expand Down Expand Up @@ -46,6 +48,8 @@ const StationInfo = ({
quickChargerCount,
} = getChargerCountsAndAvailability(chargers);

const { navigationBarPanel } = useNavigationBar();

const availabilityColor = MARKER_COLORS[isAvailable ? 'available' : 'noAvailable'];

return (
Expand Down Expand Up @@ -102,16 +106,17 @@ const StationInfo = ({
</Text>
</FlexBox>

<FlexBox mt={3} justifyContent="between">
<Button onClick={handleOpenStationDetail} hover>
<FlexBox alignItems="center">
<Text variant="label" mb={0.75}>
상세 정보 보기
</Text>
<HiChevronRight />
</FlexBox>
</Button>
<FlexBox mt={3} justifyContent="between" mb={0.75}>
<PathFinding address={address} latitude={latitude} longitude={longitude} />

{navigationBarPanel.lastPanel === null && (
<Button onClick={handleOpenStationDetail} hover>
<FlexBox alignItems="center">
<Text variant="label">상세 정보 보기</Text>
<HiChevronRight />
</FlexBox>
</Button>
)}
</FlexBox>
</Box>
);
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/components/ui/StationListWindow/StationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { useStationMarkersQuery } from '@marker/components/SmallMediumDeltaAreaM
import List from '@common/List';
import Text from '@common/Text';

import StationSummaryCard from '@ui/StationListWindow/StationSummaryCard';

import { MOBILE_BREAKPOINT } from '@constants';

import StationSummaryCardList from './StationSummaryCardList';
Expand Down Expand Up @@ -64,7 +66,7 @@ const StationList = () => {

return (
<>
<StationSummaryCardList cachedStationSummaries={cachedStationSummaries} data={data} />
<StationSummaryCardList data={data} />
{isFetchingNextPage && <StationListSkeletons />}
{canFetchNextPage && <div ref={loadMoreElementRef} />}

Expand All @@ -81,7 +83,14 @@ const StationList = () => {
);
};

return <List css={stationListCss}>{renderStationSummaryCards()}</List>;
return (
<List css={stationListCss}>
{cachedStationSummaries.map((stationSummary) => (
<StationSummaryCard key={stationSummary.stationId} station={stationSummary} />
))}
{renderStationSummaryCards()}
</List>
);
};

export const stationListCss = css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@ import { Fragment } from 'react';

import type { InfiniteData } from '@tanstack/react-query';

import type { StationSummary } from '@type';

import StationSummaryCard from './StationSummaryCard';
import type { StationSummaryResponse } from './hooks/useInfiniteStationSummaries';

export interface StationSummaryCardListProps {
cachedStationSummaries: StationSummary[];
data: InfiniteData<StationSummaryResponse>;
}

const StationSummaryCardList = ({ cachedStationSummaries, data }: StationSummaryCardListProps) => {
const StationSummaryCardList = ({ data }: StationSummaryCardListProps) => {
return (
<>
{cachedStationSummaries.map((stationSummary) => (
<StationSummaryCard key={stationSummary.stationId} station={stationSummary} />
))}
{data.pages.map((page) => (
<Fragment key={page.nextPage}>
{page.stations.map((stationSummary) => (
Expand Down
Loading

0 comments on commit d625ffd

Please sign in to comment.