-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
7df0fda
commit 71f093e
Showing
18 changed files
with
934 additions
and
348 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = { | ||
template: require('./svgr-template'), | ||
dimensions: false | ||
template: require('../../svgr-template'), | ||
dimensions: false, | ||
replaceAttrValues: { | ||
red: '{props.fill}' | ||
} | ||
} |
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,27 @@ | ||
import type { ComponentType, SVGProps } from 'react' | ||
|
||
import type { IconColors } from 'foundations' | ||
|
||
export const iconSizes = { | ||
xs: 14, | ||
s: 16, | ||
m: 20, | ||
l: 24, | ||
xl: 30, | ||
'2xl': 32 | ||
} | ||
|
||
type IconSize = keyof typeof iconSizes | ||
|
||
type SVGBaseProps = SVGProps<SVGSVGElement> | ||
|
||
export type IconProps = { | ||
color?: IconColors | ||
size?: IconSize | ||
sizeW?: IconSize | ||
sizeH?: IconSize | ||
} | ||
|
||
type SVGIconProps = SVGBaseProps & IconProps | ||
|
||
export type IconComponent = ComponentType<SVGBaseProps | SVGIconProps> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
module.exports = { | ||
template: require('../../svgr-template'), | ||
dimensions: false, | ||
replaceAttrValues: { | ||
'#FF0000': '{props.fill}', | ||
'#000': '{props.fill}', | ||
'#f00': '{props.fillSecondary}' | ||
} | ||
} |
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
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,8 @@ | ||
import type { IconProps as HarmonyIconProps } from '@audius/harmony' | ||
import type { SvgProps } from 'react-native-svg' | ||
|
||
export * from '@audius/harmony/src/icons' | ||
|
||
export type IconProps = SvgProps & HarmonyIconProps & { fillSecondary?: string } | ||
|
||
export type Icon = React.FC<IconProps> |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './foundations' | ||
export * from './components' | ||
export * from './icons' |
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
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
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,34 @@ | ||
const template = (variables, { tpl }) => { | ||
return tpl` | ||
${variables.imports}; | ||
import {useTheme} from '@emotion/react' | ||
${variables.interfaces}; | ||
const ${variables.componentName} = (${variables.props}) => { | ||
const theme = useTheme() | ||
const { | ||
color, | ||
size, | ||
sizeH, | ||
sizeW, | ||
height: heightProp, | ||
width: widthProp, | ||
fill: fillProp, | ||
...other | ||
} = props | ||
const height = heightProp ?? theme.iconSizes[sizeH ?? size ?? 'l'] | ||
const width = widthProp ?? theme.iconSizes[sizeW ?? size ?? 'l'] | ||
const fill = fillProp ?? theme.color.icon[color] ?? 'red' | ||
props = {...other, height, width, fill} | ||
return (${variables.jsx}) | ||
}; | ||
${variables.exports}; | ||
` | ||
} | ||
|
||
module.exports = template |