-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
344 additions
and
4 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
packages/taro-components-react/src/components/icon/index.tsx
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,31 @@ | ||
import './style/index.scss' | ||
|
||
import classNames from 'classnames' | ||
import React from 'react' | ||
|
||
import { omit } from '../../utils' | ||
|
||
|
||
interface IProps { | ||
type: string | ||
color: string | ||
size?: number | string | ||
className?: string | ||
} | ||
|
||
const Icon = (props: IProps) => { | ||
let { type, className = '', size = '23', color } = props | ||
if (type) type = type.replace(/_/g, '-') | ||
const cls = classNames( | ||
{ | ||
[`weui-icon-${type}`]: true | ||
}, | ||
className | ||
) | ||
const style = { 'font-size': size + 'px', color: color } | ||
|
||
return ( | ||
<i {...omit(props, ['type', 'className'])} className={cls} style={style} /> | ||
) | ||
} | ||
export default Icon |
304 changes: 304 additions & 0 deletions
304
packages/taro-components-react/src/components/icon/style/index.scss
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
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