-
Notifications
You must be signed in to change notification settings - Fork 5
/
Icon.story.js
66 lines (63 loc) · 1.75 KB
/
Icon.story.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from "react";
import Text, { fontSizes, fontTypes } from "@crave/farmblocks-text";
import {
SmPlaceholder,
MdWallet,
SmEdit,
LgGroceryItems,
MdPickupLocationFilled,
} from ".";
import Icon from "./Icon";
import LgPhoto from "./svg/Actions/LgPhoto.svg";
import IconsBrowser, { Pre } from "./IconsBrowser";
export default {
title: "Assets|Icons",
component: Icon,
parameters: {
componentSubtitle: "A list of SVG icons in JSX",
},
};
export const basic = () => <SmPlaceholder />;
export const insideText = () => (
<>
<Text type={fontTypes.POSITIVE}>
<SmEdit /> The icons will inherit the color of the parent element.
</Text>
<Text size={fontSizes.SMALL}>
<MdWallet /> They also inherit the text size.
</Text>
<Text>
But you can override it with the <Pre>size</Pre> (
<LgGroceryItems size={110} />) and <Pre>color</Pre> (
<MdPickupLocationFilled color="indianred" />) props.
</Text>
</>
);
export const SVGFile = () => (
<>
<Text>You can import the original svg files intead of the JSX ones:</Text>
<p>
<Pre>
{/* eslint-disable-next-line */}
{`import LgPhoto from '@crave/farmblocks-icon/svg/Actions/LgPhoto.svg';`}
</Pre>
</p>
<Text>
Doing this, you won't have the props to customize it, but you can do
things like using it as <Pre>src</Pre> for an <Pre>img</Pre> element or as{" "}
<Pre>background-image</Pre>:
</Text>
<textarea
style={{
backgroundImage: `
linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.9)),
url(${LgPhoto})`,
width: 270,
height: 160,
}}
>
Resize me
</textarea>
</>
);
export const allIcons = () => <IconsBrowser />;