Skip to content

Commit

Permalink
feat: 새 아이콘 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-yn committed Mar 2, 2024
1 parent 13f74ca commit 6c9b88c
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 76 deletions.
2 changes: 2 additions & 0 deletions src/app/sungyeon/context.ts → src/app/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createStaticContext } from '@/utils/context/StaticContext';

export interface UserInfoData {
token: UserNameToken;
id: string;
name: string;
email: string;
Expand All @@ -22,6 +23,7 @@ interface PageInfoData {

export const StaticContextPageInfo = createStaticContext<PageInfoData>({
userInfo: {
token: 'sungyeon',
id: '',
name: '',
email: '',
Expand Down
3 changes: 2 additions & 1 deletion src/app/sungyeon/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getSectionsByUserIdQuery } from '@/helper/getSectionByUserIdQuery';
import { getUserByNameQuery } from '@/helper/getUserByNameQuery';
import { backgroundColorVariants } from '@/styles/common/color.css';
import { sungyeonColorTheme } from '@/styles/theme/sungyeon.css';
import { StaticContextPageInfo } from './context';
import { StaticContextPageInfo } from '../context';

const Sungyeon = async () => {
const apolloClient = getClient();
Expand All @@ -24,6 +24,7 @@ const Sungyeon = async () => {
<StaticContextPageInfo.Provider
value={{
userInfo: {
token: 'sungyeon',
id: getUserByName.id,
name: getUserByName.name,
email: getUserByName.email,
Expand Down
3 changes: 3 additions & 0 deletions src/components/Card/History/Impact/HistoryImpactCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import classNames from 'classnames';
import React, { PropsWithChildren } from 'react';
import { StaticContextPageInfo } from '@/app/context';
import CommonIcon from '@/composable/Icon/CommonIcon';
import { getStaticContext } from '@/utils/context/StaticContext';
import calcRemToPxNumber from '@/utils/style/calcRemToPxNumber';
Expand Down Expand Up @@ -59,6 +60,7 @@ const HistoryImpactCard = ({
};

const Headline = () => {
const { userInfo } = getStaticContext(StaticContextPageInfo);
const { sizeToken, before, after, unitWord } = getStaticContext(
StaticContextHistoryImpactCard,
);
Expand All @@ -77,6 +79,7 @@ const Headline = () => {
sizeToken ? iconStyleVariants[sizeToken] : iconStyle,
)}
variant="LEFT_ARROW_SECONDARY_VARIANT"
userToken={userInfo.token}
width={calcRemToPxNumber('1.5rem')}
height={calcRemToPxNumber('1.5rem')}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/HistorySlideButton/HistorySlideButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const HistorySlideButton = ({ direction }: Props) => {
<CommonIcon
className={iconVariants[direction]}
variant="LEFT_ARROW_SECONDARY_VARIANT"
userToken="sungyeon"
width={24}
height={24}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/NormalProject/NormalProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ const ButtonBox = (props: ButtonBoxProps) => {
<CommonIcon
className={iconVariants[direction]}
variant="LEFT_ARROW_SECONDARY_VARIANT"
userToken="sungyeon"
format="png"
width={40}
height={40}
Expand Down
71 changes: 69 additions & 2 deletions src/components/storybook/IconBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ const IconBoard = () => {
<Grid
className={backgroundColorVariants['gray-scale-01']}
autoFlow="column"
templateColumns="repeat(7, 2rem)"
autoColumns="auto"
style={gridStyle}
>
<IconBoard.Common />
</Grid>

<Grid
className={backgroundColorVariants['gray-scale-03']}
autoFlow="column"
autoColumns="auto"
style={gridStyle}
>
<IconBoard.Common2 />
</Grid>
<Text
as="h1"
typoToken="display-m-bold"
Expand Down Expand Up @@ -260,11 +267,71 @@ const Common = ({ format }: CommonProps) => {
format={format}
/>
<CommonIcon variant="UP_ARROW" width={32} height={32} format={format} />
<CommonIcon variant="PLUS" width={32} height={32} format={format} />
</>
);
};

const Common2 = ({ format }: CommonProps) => {
return (
<>
<CommonIcon
variant="RIGHT_TAIL_ARROW"
width={36}
height={36}
format={format}
/>
<CommonIcon
variant="RIGHT_TAIL_ARROW_MEDIUM"
width={48}
height={48}
format={format}
/>
<CommonIcon
variant="RIGHT_TAIL_ARROW_SECONDARY_VARIANT"
userToken="sungyeon"
width={36}
height={36}
format={format}
/>
<CommonIcon
variant="LEFT_ARROW_SECONDARY_VARIANT"
userToken="sungyeon"
width={36}
height={36}
format={format}
/>
<CommonIcon variant="MEATBALL" width={24} height={24} format={format} />
<CommonIcon
variant="PAGINATION_SELECTED_SKY_BLUE_LARGE"
width={44}
height={44}
format={format}
/>
<CommonIcon
variant="PAGINATION_SELECTED_SKY_BLUE_MEDIUM"
width={40}
height={40}
format={format}
/>
<CommonIcon
variant="PAGINATION_UNSELECTED_SKY_BLUE_LARGE"
width={24}
height={24}
format={format}
/>
<CommonIcon
variant="PAGINATION_UNSELECTED_SKY_BLUE_MEDIUM"
width={16}
height={16}
format={format}
/>
</>
);
};

IconBoard.Social = Social;
IconBoard.Common = Common;
IconBoard.Common2 = Common2;

export default IconBoard;
14 changes: 12 additions & 2 deletions src/composable/Icon/CommonIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ import iconAssetEndpoint from '@/utils/string/iconAssetEndpoint';

type CommonIconProps = IconProps & {
variant: CommonIconToken;
userToken?: UserNameToken;
};

const CommonIcon = ({ variant, format, ...props }: CommonIconProps) => {
const path = iconAssetEndpoint(variant, '/common');
const CommonIcon = ({
variant,
userToken,
format,
...props
}: CommonIconProps) => {
const path = iconAssetEndpoint({
iconName: variant,
userName: userToken,
prefix: '/common',
});

return <Image {...props} src={`${path}.${format || 'png'}`} alt={variant} />;
};
Expand Down
4 changes: 3 additions & 1 deletion src/composable/Icon/SocialIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const SocialIcon = ({
state,
});

const path = iconAssetEndpoint(company);
const path = iconAssetEndpoint({
iconName: company,
});

return (
<Image
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Contents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StaticContextPageInfo } from '@/app/sungyeon/context';
import { StaticContextPageInfo } from '@/app/context';
import { getStaticContext } from '@/utils/context/StaticContext';
import ContactContainer from './Contact';
import HistoryContainer from './History';
Expand Down
66 changes: 0 additions & 66 deletions src/types/designToken/Color.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,69 +43,3 @@ type UserColorThemeToken =
| 'accent'
| 'tertiary'
| 'tertiary-variant';

// interface JaeyoonMainColorTokenInterface {
// 'jaeyoon-01': string;
// 'jaeyoon-02': string;
// 'jaeyoon-03': string;
// 'jaeyoon-04': string;
// 'jaeyoon-05': string;
// }

// interface SungyeonMainColorTokenInterface {
// 'sungyeon-01': string;
// 'sungyeon-02': string;
// 'sungyeon-03': string;
// 'sungyeon-04': string;
// 'sungyeon-05': string;
// 'sungyeon-primary-200': string;
// 'sungyeon-tertiary-100': string;
// 'sungyeon-tertiary-200': string;
// }

// interface YejiMainColorTokenInterface {
// 'yeji-01': string;
// 'yeji-02': string;
// 'yeji-03': string;
// 'yeji-04': string;
// 'yeji-05': string;
// }

// interface ODSColorTokenInterface
// extends GrayScaleTokenInterface,
// SungyeonMainColorTokenInterface,
// YejiMainColorTokenInterface,
// JaeyoonMainColorTokenInterface {
// transparent: string;
// }

// type SungyeonMainColorToken =
// | 'sungyeon-01'
// | 'sungyeon-02'
// | 'sungyeon-03'
// | 'sungyeon-04'
// | 'sungyeon-05'
// | 'sungyeon-primary-200'
// | 'sungyeon-tertiary-100'
// | 'sungyeon-tertiary-200';

// type YejiMainColorToken =
// | 'yeji-01'
// | 'yeji-02'
// | 'yeji-03'
// | 'yeji-04'
// | 'yeji-05';

// type JaeyoonMainColorToken =
// | 'jaeyoon-01'
// | 'jaeyoon-02'
// | 'jaeyoon-03'
// | 'jaeyoon-04'
// | 'jaeyoon-05';

// type ODSColorToken =
// | GrayScaleToken
// | SungyeonMainColorToken
// | YejiMainColorToken
// | JaeyoonMainColorToken
// | 'transparent';
11 changes: 10 additions & 1 deletion src/types/designToken/Icon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ type CommonIconToken =
| 'UP_ARROW'
| 'LEFT_ARROW'
| 'LEFT_ARROW_SECONDARY_VARIANT'
| 'RIGHT_TAIL_ARROW'
| 'RIGHT_TAIL_ARROW_MEDIUM'
| 'RIGHT_TAIL_ARROW_SECONDARY_VARIANT'
| 'ROUND_CLOSE'
| 'NORMAL_CLOSE'
| 'LARGE_CLOSE';
| 'LARGE_CLOSE'
| 'PLUS'
| 'MEATBALL'
| 'PAGINATION_SELECTED_SKY_BLUE_MEDIUM'
| 'PAGINATION_SELECTED_SKY_BLUE_LARGE'
| 'PAGINATION_UNSELECTED_SKY_BLUE_MEDIUM'
| 'PAGINATION_UNSELECTED_SKY_BLUE_LARGE';

type CompanyIconToken =
| 'GOOGLE'
Expand Down
14 changes: 12 additions & 2 deletions src/utils/string/iconAssetEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { ASSET_ENDPOINT } from '@/const/endpoint';

const iconAssetEndpoint = (iconName: string, prefix?: string) => {
const iconAssetEndpoint = ({
iconName,
userName,
prefix,
}: {
iconName: string;
userName?: string;
prefix?: string;
}) => {
const prefixPath = prefix ? `${prefix}` : '';
return `${ASSET_ENDPOINT}/icons${prefixPath}/${iconName.toLowerCase()}`;
return `${ASSET_ENDPOINT}/icons${prefixPath}/${iconName.toLowerCase()}${
userName ? `_${userName.toLowerCase()}` : ''
}`;
};

export default iconAssetEndpoint;

0 comments on commit 6c9b88c

Please sign in to comment.