File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
// 이 파일은 `python3 @fox/tools/build-icons.py`가 만든다. 손으로 고치지 않는다.
//
// 모든 아이콘이 공유하는 껍데기. 아이콘은 **크기도 색도 갖지 않는다** — 감싼 쪽이
// `inline-size`/`block-size`로 정하고 `viewBox`가 따라 늘어나며, 색은 `fill: currentColor`라
// 감싼 쪽의 `color`를 쓴다. 장식 요소라 `aria-hidden`이며, 접근성 이름은 소비처가 책임진다.
/** 시안의 `Weight=` 변형. */
export type FoxIconWeight =
| "thin"
| "light"
| "regular"
| "bold"
| "fill"
| "duotone";
/** `[d, opacity?]` — duotone의 배경 path만 opacity를 갖는다. */
export type FoxGlyphPath = readonly [d: string, opacity?: number];
export type FoxGlyph = Readonly<Record<FoxIconWeight, readonly FoxGlyphPath[]>>;
export interface FoxIconProps {
/** 기본 `regular`. 시안이 굵기를 지정한 자리에서만 바꾼다. */
weight?: FoxIconWeight;
}
interface FoxIconInternalProps extends FoxIconProps {
glyph: FoxGlyph;
}
export function FoxIcon({ weight = "regular", glyph }: FoxIconInternalProps) {
return (
<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true">
{glyph[weight].map(([d, opacity], index) => (
<path key={index} d={d} opacity={opacity} />
))}
</svg>
);
}