-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui-kit): apple-logo-ar 아이콘의 경우에는 무조건 outline으로 타입이 지정되도록 수정 (#91)
- Loading branch information
Showing
3 changed files
with
78 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { IconType } from '.'; | ||
|
||
export async function fetchIcon(name: string) { | ||
const response = await fetch(getIconUrl(name)); | ||
const body = await response.text(); | ||
if (response.ok) { | ||
return body; | ||
} else { | ||
throw new Error(body); | ||
} | ||
} | ||
|
||
export const getIconType = (iconName: string, iconType: IconType) => { | ||
if (iconName === 'logo-apple-ar') { | ||
return 'outline'; | ||
} else { | ||
return /^logo-.+/.test(iconName) ? 'filled' : iconType; | ||
} | ||
}; | ||
|
||
export function getIconName(name: string, type: IconType) { | ||
if (name === 'logo-apple-ar') { | ||
return name; | ||
} | ||
|
||
return type === 'filled' ? name : `${name}-${type}`; | ||
} | ||
|
||
export function getIconUrl(name: string) { | ||
return `https://icons.lubycon.io/${name}.svg`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters