Skip to content

Commit

Permalink
feat: clear icon 클릭시 동작 함수 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
eunbae0 committed Jan 29, 2024
1 parent aa752a7 commit e8ce1dc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/molecules/Timelines/Timelines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import styled from '@emotion/styled';
import TimelineBar from '../../atoms/timelineBar';
import { useEffect, useMemo, useState } from 'react';
import { TimelineOrder } from '../../templates/TimelineView';
import Icon from '../../atoms/Icon';
import { css } from '@emotion/react';
import useHandleClearIcon from '../../../hooks/useHandleClearIcon';

export type TimelineBarStatus = 'DISPLAYED' | 'DISPLAYING' | 'UNDISPLAYED';
type TimelineBarStatusType = Array<{
Expand All @@ -14,6 +17,7 @@ type Props = {
};

const Timelines = ({ currentOrder }: Props) => {
const handleClickClearIcon = useHandleClearIcon();
const initTimelineBarStatus: TimelineBarStatusType = useMemo(
() =>
Array(5)
Expand Down Expand Up @@ -45,6 +49,18 @@ const Timelines = ({ currentOrder }: Props) => {
<TimelineBar key={item.index} status={item.status} />
))}
</S.TimelinesWrapper>
<Icon
name={'clear'}
css={css`
position: absolute;
top: 50px;
right: 12px;
cursor: pointer;
z-index: 10;
padding: 4px;
`}
onClick={handleClickClearIcon}
/>
</S.Container>
);
};
Expand Down
15 changes: 15 additions & 0 deletions src/components/pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@ import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { Txt, colors } from '@uoslife/design-system/web';
import useUserStore from '../../../store/user';
import Icon from '../../atoms/Icon';
import useHandleClearIcon from '../../../hooks/useHandleClearIcon';

type Props = { setTimelineView: () => void };

const MainPage = ({ setTimelineView }: Props) => {
const { user } = useUserStore();

const handleClickClearIcon = useHandleClearIcon();

return (
<S.Container>
<Icon
name={'clear'}
css={css`
position: absolute;
top: 12px;
right: 16px;
cursor: pointer;
`}
onClick={handleClickClearIcon}
/>
<img
css={css`
width: 316px;
Expand Down

0 comments on commit e8ce1dc

Please sign in to comment.