/
example.jsx
75 lines (68 loc) · 1.88 KB
/
example.jsx
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
67
68
69
70
71
72
73
74
75
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
import React from 'react';
import _ from '../../../shared/helpers';
import classNames from 'classnames';
import PropTypes from 'prop-types';
// This icon is a sprite of 20 frames laid out horizontally
// Each frame is composed of 2 circles positioned on top of each other
const frames = 20;
export const Ellie = props => (
<span
className={classNames('slds-icon-ellie', props.className)}
title={props.title}
>
<svg viewBox={`0 0 ${frames * 14} 14`} aria-hidden="true">
{/* Loop through frames 1 through 20 */}
{_.range(1, frames + 1).map(frame => [
<circle
cx={14 * frame - 7}
cy="7"
r="4"
key={`outer-circle-${frame}`}
/>,
<circle
cx={14 * frame - 7}
cy="7"
r="3"
key={`inner-circle-${frame}`}
/>
])}
</svg>
<span className="slds-assistive-text">{props.assistiveText}</span>
</span>
);
Ellie.propTypes = {
title: PropTypes.string.isRequired,
assistiveText: PropTypes.string.isRequired
};
/* -----------------------------------------------------------------------------
Exports
----------------------------------------------------------------------------- */
export default (
<Ellie
className="slds-is-animated"
title="Description of the icon"
assistiveText="Text alternative"
/>
);
export let states = [
{
id: 'paused',
label: 'Paused',
element: (
<Ellie
className="slds-is-animated slds-is-paused"
title="Description of the icon"
assistiveText="Text alternative"
/>
)
},
{
id: 'static',
label: 'Static (no animation)',
element: (
<Ellie title="Description of the icon" assistiveText="Text alternative" />
)
}
];