Skip to content

Commit

Permalink
fix: iconAssetEndpoint 함수에서 prefix 문자열 넣을수 있도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-yn committed Nov 28, 2023
1 parent fcfab6c commit 601c9c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/composable/Icon/CommonIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import iconAssetEndpoint from '@/utils/string/iconAssetEndpoint';

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

return <Image {...props} src={`${path}.${format || 'png'}`} alt={variant} />;
};
Expand Down
5 changes: 3 additions & 2 deletions src/utils/string/iconAssetEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ASSET_ENDPOINT } from '@/const/endpoint';

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

export default iconAssetEndpoint;

0 comments on commit 601c9c7

Please sign in to comment.