Код: Выделить всё
type IconProps = ComponentProps
const Icon = (props: IconProps) => {
const [, rest] = splitProps(props, ["class"])
return (
)
}
export function IconUser(props: IconProps) {
return (
)
}
Код: Выделить всё
export const SettingButton = (props: {
title: string;
icon: ?; // JSX.Element maybe?
onPress: () => void;
}) => {
const { hovering, hoveringProps } = useHovering();
const responsive = useResponsiveV2();
const color = () => {
if (hovering()) {
return c.colors.text.secondary;
}
return c.colors.text.tertiary;
};
return (
? // {props.icon} works but I want to add the style prop to it here
// Ideally {props.icon style={{color: color()}}}
)
// Usage: {}} />
Кроме того, я знаю, что могу обернуть это в div и применить стиль есть, но мне интересно, как это сделать правильно.
Подробнее здесь: https://stackoverflow.com/questions/793 ... typescript
Мобильная версия