Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:MOONSHOT-Team/MOONSHOT-CLIENT in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
Yeonseo-Jo committed May 2, 2024
2 parents df16509 + ac80f0c commit 871e8b5
Show file tree
Hide file tree
Showing 26 changed files with 640 additions and 774 deletions.
9 changes: 7 additions & 2 deletions src/History/apis/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import instance from '@apis/instance';

export const getOKRHistory = async (url: string) => {
const response = await instance.get(url);
export const getOKRHistory = async (url: string, category?: string, criteria?: string) => {
const response = await instance.get(url, {
params: {
category,
criteria,
},
});

return response;
};
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 4 additions & 4 deletions src/History/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CheckIcon from './CheckIcon.svg?react';
import DropDownIcon from './DropDownIcon.svg?react';
import FilteringIcon from './FilteringIcon.svg?react';
import IcCheck from './icCheck.svg?react';
import IcDropDown from './icDropDown.svg?react';
import IcSmallDropDown from './icSmallDropDown.svg?react';

export { CheckIcon, DropDownIcon, FilteringIcon };
export { IcCheck, IcDropDown, IcSmallDropDown };
131 changes: 0 additions & 131 deletions src/History/components/HistoryDrawer.tsx

This file was deleted.

51 changes: 0 additions & 51 deletions src/History/components/ThemeButton.tsx

This file was deleted.

51 changes: 0 additions & 51 deletions src/History/components/YearButton.tsx

This file was deleted.

89 changes: 89 additions & 0 deletions src/History/components/drawer/CategoryContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';

import { IcCheck } from '../../assets/icons';
import { selectedThemeTypes } from '../../type/historyData';

interface ICategoriesProps {
label: string;
allCategories: selectedThemeTypes[];
selectedCategory: string | undefined;
historyCategories: selectedThemeTypes[];
onCategorySelect: (category: selectedThemeTypes) => void;
}

const CategoryContainer = ({
label,
allCategories,
selectedCategory,
historyCategories,
onCategorySelect,
}: ICategoriesProps) => {
return (
<div css={categoriesWrapper}>
<StTitle>{label}</StTitle>
<div css={sortCategories}>
{allCategories?.map((category) => {
const isHavingCategoryData = historyCategories.includes(category);

return (
<StCategory
key={category}
isHavingCategoryData={isHavingCategoryData}
disabled={!isHavingCategoryData}
onClick={() => {
onCategorySelect(category);
}}
>
{category === selectedCategory && <IcCheck />}
<span>{category}</span>
</StCategory>
);
})}
</div>
</div>
);
};

const categoriesWrapper = css`
display: flex;
flex-direction: column;
gap: 1.6rem;
width: 18.8rem;
height: 17.4rem;
`;

const sortCategories = css`
display: flex;
flex-wrap: wrap;
gap: 1.1rem 0.6rem;
`;

const StTitle = styled.label`
color: ${({ theme }) => theme.colors.gray_000};
${({ theme }) => theme.fonts.body_12_regular};
`;

const StCategory = styled.button<{ isHavingCategoryData?: boolean }>`
display: flex;
gap: 0.4rem;
align-items: center;
justify-content: center;
width: fit-content;
height: 2.7rem;
padding: 0.8rem 1rem;
color: ${({ theme, isHavingCategoryData }) =>
isHavingCategoryData ? theme.colors.gray_000 : theme.colors.gray_450};
cursor: ${({ isHavingCategoryData }) => (isHavingCategoryData ? 'pointer' : 'default')};
background-color: ${({ theme, isHavingCategoryData }) =>
isHavingCategoryData ? theme.colors.background : theme.colors.gray_550};
border: 1px solid
${({ theme, isHavingCategoryData }) =>
isHavingCategoryData ? theme.colors.gray_350 : theme.colors.gray_450};
border-radius: 6px;
${({ theme }) => theme.fonts.btn_11_medium};
`;

export default CategoryContainer;
42 changes: 42 additions & 0 deletions src/History/components/drawer/HistoryDrawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import styled from '@emotion/styled';

import { HISTORY_THEME } from '../../constants/HISTORY_THEME';
import { selectedThemeTypes } from '../../type/historyData';
import CategoryContainer from './CategoryContainer';

interface IHistoryDrawerProps {
historyCategories: selectedThemeTypes[];
selectedTheme: string | undefined;
onSelectTheme: (selectedTheme: selectedThemeTypes) => void;
}

const HistoryDrawer = ({
historyCategories,
selectedTheme,
onSelectTheme,
}: IHistoryDrawerProps) => {
return (
<StHistoryAside>
<CategoryContainer
label="테마"
allCategories={HISTORY_THEME}
historyCategories={historyCategories}
selectedCategory={selectedTheme}
onCategorySelect={onSelectTheme}
/>
</StHistoryAside>
);
};

export default HistoryDrawer;

const StHistoryAside = styled.aside`
display: flex;
flex-direction: column;
flex-shrink: 0;
gap: 4rem;
width: 23.2rem;
height: 100%;
padding: 2.4rem 2.2rem;
background-color: ${({ theme }) => theme.colors.gray_650};
`;
Loading

0 comments on commit 871e8b5

Please sign in to comment.