Skip to content

Commit c9081b2

Browse files
author
shenzhiqing
committed
doc(icon): 增加实例
1 parent 81e6e7b commit c9081b2

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

example/examples/src/routes/Icon/index.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,22 @@ export default class IconPage extends React.Component<IconPageProps> {
274274
const {route} = this.props;
275275
const description = route.params.description;
276276
const title = route.params.title;
277+
const xml = `
278+
<svg width="20" height="20" viewBox="0 0 20 20">
279+
<path
280+
fill-rule="evenodd"
281+
fill="#000"
282+
d="M19 8h-1.26c-.19-.73-.48-1.42-.85-2.06l.94-.94a.996.996 0 0 0 0-1.41l-1.41-1.41a.996.996 0 0 0-1.41 0l-.94.94c-.65-.38-1.34-.67-2.07-.86V1c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v1.26c-.76.2-1.47.5-2.13.89L5 2.28a.972.972 0 0 0-1.36 0L2.28 3.64c-.37.38-.37.98 0 1.36l.87.87c-.39.66-.69 1.37-.89 2.13H1c-.55 0-1 .45-1 1v2c0 .55.45 1 1 1h1.26c.19.73.48 1.42.85 2.06l-.94.94a.996.996 0 0 0 0 1.41l1.41 1.41c.39.39 1.02.39 1.41 0l.94-.94c.64.38 1.33.66 2.06.85V19c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-1.26c.76-.2 1.47-.5 2.13-.89l.88.87c.37.37.98.37 1.36 0l1.36-1.36c.37-.38.37-.98 0-1.36l-.87-.87c.4-.65.7-1.37.89-2.13H19c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zm-9 7c-2.76 0-5-2.24-5-5s2.24-5 5-5v10z"
283+
/>
284+
</svg>
285+
`;
277286
return (
278287
<Container>
279288
<Layout>
280289
<Header title={title} description={description} />
281290
<Body>
282291
<Card title="自定义图标">
292+
<Icon name="apple" size={18} color="#50CB42" />
283293
<Icon
284294
paths={[
285295
'M19 0H7c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h5.59l3.71 3.71c.17.18.42.29.7.29.55 0 1-.45 1-1v-3h1c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1zM7 13c-1.1 0-2-.9-2-2V4H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h1v3a1.003 1.003 0 0 0 1.71.71L7.41 16H13c.55 0 1-.45 1-1v-.17L12.17 13H7z',
@@ -295,7 +305,28 @@ export default class IconPage extends React.Component<IconPageProps> {
295305
size={18}
296306
style={styles.icon}
297307
/>
298-
<Icon name="apple" size={18} color="#50CB42" />
308+
<Icon
309+
size={40}
310+
xml={`
311+
<svg
312+
width="130"
313+
height="130"
314+
fill="blue"
315+
stroke="red"
316+
color="green"
317+
viewBox="-16 -16 544 544"
318+
>
319+
<path
320+
d="M318.37,85.45L422.53,190.11,158.89,455,54.79,350.38ZM501.56,60.2L455.11,13.53a45.93,45.93,0,0,0-65.11,0L345.51,58.24,449.66,162.9l51.9-52.15A35.8,35.8,0,0,0,501.56,60.2ZM0.29,497.49a11.88,11.88,0,0,0,14.34,14.17l116.06-28.28L26.59,378.72Z"
321+
strokeWidth="32"
322+
/>
323+
<path d="M0,0L512,512" stroke="currentColor" strokeWidth="32" />
324+
</svg>
325+
`}
326+
/>
327+
<Icon size={46} xml={xml} />
328+
<Icon name="apple" height={42} width={40} fill="#E3BD8D" stroke="#4d4030" />
329+
<Icon name="apple" height={42} width={40} fill="#E2D849" stroke="#FF9900" />
299330
</Card>
300331
<Card title="UIW Icon" extra={<LinkButtons />}>
301332
<View style={styles.list}>

0 commit comments

Comments
 (0)