mirror of
https://github.com/status-im/status-web.git
synced 2025-01-11 21:24:34 +00:00
9479b4bb2f
* feat: add wallet page and all its necessary components * feat: border and address element * feat: add navigation with responsive view * feat: add floating menu for mobile version * fix: floating menu mobile * fix: menu floating and footer * feat: adds prefooter and fixes footer and pages layouts * fix: footer mobile border * fix: pages with new layout * fix: minor fixes * fix: some minor fixes * fix: changes from review * fix: performance safari issue * fix: changes from review * feat: add grid hero component with proper variants * fix: remove unnecessary prop * feat: some improvements to shared components * fix: nav-desktop z-index * add passive option to scroll listener * lint tailwind classnames --------- Co-authored-by: Pavel Prichodko <14926950+prichodko@users.noreply.github.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { createElement, forwardRef } from 'react'
|
|
|
|
import { useTheme } from '@tamagui/core'
|
|
|
|
import type { ColorTokens } from '@tamagui/core'
|
|
import type { ComponentType, SVGProps } from 'react'
|
|
|
|
// import 'react-native-svg'
|
|
// declare module 'react-native-svg' {
|
|
// export interface SvgProps {
|
|
// xmlns?: string
|
|
// xmlnsXlink?: string
|
|
// xlinkHref?: string
|
|
// }
|
|
// }
|
|
|
|
function isColorTokens(
|
|
value: `#${string}` | ColorTokens
|
|
): value is ColorTokens {
|
|
return typeof value === 'string' && value.startsWith('$')
|
|
}
|
|
|
|
export interface IconProps extends SVGProps<SVGSVGElement> {
|
|
size: 12 | 16 | 20
|
|
color?: ColorTokens | `#${string}`
|
|
}
|
|
|
|
export function createIcon<P extends SVGProps<SVGSVGElement>>(
|
|
Component: ComponentType<P>
|
|
): ComponentType<IconProps> {
|
|
const Icon = forwardRef<SVGElement, IconProps>((props, ref) => {
|
|
const { size, color = '$neutral-100', ...rest } = props
|
|
const theme = useTheme()
|
|
const token = isColorTokens(color) ? theme[color]?.val : color
|
|
|
|
return createElement(Component, {
|
|
ref,
|
|
...(rest as P),
|
|
color: token,
|
|
width: size,
|
|
height: size,
|
|
})
|
|
})
|
|
|
|
Icon.displayName = Component.name + 'Icon'
|
|
|
|
return Icon as ComponentType<IconProps>
|
|
}
|