feat: 聊天页暗夜模式
This commit is contained in:
@@ -4,18 +4,18 @@ import { Icon } from '@chakra-ui/react';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const map = {
|
||||
model: dynamic(() => import('./icons/model.svg')),
|
||||
share: dynamic(() => import('./icons/share.svg')),
|
||||
home: dynamic(() => import('./icons/home.svg'))
|
||||
model: require('./icons/model.svg').default,
|
||||
share: require('./icons/share.svg').default,
|
||||
home: require('./icons/home.svg').default,
|
||||
menu: require('./icons/menu.svg').default
|
||||
};
|
||||
|
||||
const MyIcon = ({
|
||||
name,
|
||||
w = 'auto',
|
||||
h = 'auto',
|
||||
...props
|
||||
}: { name: keyof typeof map } & IconProps) => {
|
||||
return map[name] ? <Icon as={map[name]} w={w} h={h} {...props} /> : null;
|
||||
export type IconName = keyof typeof map;
|
||||
|
||||
const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconName } & IconProps) => {
|
||||
return map[name] ? (
|
||||
<Icon as={map[name]} w={w} h={h} boxSizing={'content-box'} verticalAlign={'top'} {...props} />
|
||||
) : null;
|
||||
};
|
||||
|
||||
export default MyIcon;
|
||||
|
||||
Reference in New Issue
Block a user