Skip to content

Commit 2f1a8c3

Browse files
author
Bruno Dias
authored
Merge pull request #325 from claudivanfilho/feature/new-icons
Feature/new icons
2 parents 9771063 + 144ce76 commit 2f1a8c3

File tree

8 files changed

+175
-1
lines changed

8 files changed

+175
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Added
10+
- `IconBars`, `IconUser` and `IconShoppingCart` components
911

1012
## [7.1.0] - 2018-10-03
1113

react/IconBars.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Bars from './components/icon/Bars/index'
2+
3+
export default Bars

react/IconShoppingCart.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import ShoppingCart from './components/icon/ShoppingCart/index'
2+
3+
export default ShoppingCart

react/IconUser.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import User from './components/icon/User/index'
2+
3+
export default User

react/components/icon/Bars/index.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React, { PureComponent } from 'react'
2+
import PropTypes from 'prop-types'
3+
import { calcIconSize, baseClassname } from '../utils'
4+
5+
const iconBase = {
6+
width: 18,
7+
height: 12,
8+
}
9+
10+
class Bars extends PureComponent {
11+
render() {
12+
const { color, size, block } = this.props
13+
const newSize = calcIconSize(iconBase, size)
14+
15+
return (
16+
<svg
17+
className={`${baseClassname('bars')} ${block ? 'db' : ''}`}
18+
width={newSize.width}
19+
height={newSize.height}
20+
viewBox="0 0 18 12"
21+
fill={color}
22+
xmlns="http://www.w3.org/2000/svg"
23+
>
24+
<path
25+
fillRule="evenodd"
26+
clipRule="evenodd"
27+
d="M0 12H18V10H0V12ZM0 7H18V5H0V7ZM0 0V2H18V0H0Z"
28+
fill={color}
29+
/>
30+
</svg>
31+
)
32+
}
33+
}
34+
35+
Bars.defaultProps = {
36+
color: 'currentColor',
37+
size: 20,
38+
block: false,
39+
}
40+
41+
Bars.propTypes = {
42+
color: PropTypes.string,
43+
size: PropTypes.number,
44+
block: PropTypes.bool,
45+
}
46+
47+
export default Bars

react/components/icon/README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Usage: <span className="c-muted-1">`import <IconName> from '@vtex/styleguide/lib
44
const ArrowBack = require('./ArrowBack').default
55
const ArrowDown = require('./ArrowDown').default
66
const ArrowUp = require('./ArrowUp').default
7+
const Bars = require('./Bars').default
78
const CaretDown = require('./CaretDown').default
89
const CaretLeft = require('./CaretLeft').default
910
const CaretRight = require('./CaretRight').default
@@ -27,10 +28,12 @@ const Link = require('./Link').default
2728
const Plus = require('./Plus').default
2829
const Save = require('./Save').default
2930
const Search = require('./Search').default
31+
const ShoppingCart = require('./ShoppingCart').default
3032
const Success = require('./Success').default
3133
const Upload = require('./Upload').default
3234
const VisibilityOff = require('./VisibilityOff').default
3335
const VisibilityOn = require('./VisibilityOn').default
36+
const User = require('./User').default
3437
const Warning = require('./Warning').default
3538
const PlusLines = require('./PlusLines').default
3639

@@ -221,7 +224,18 @@ const demoLabel = 'pb3 code c-muted-1 f6'
221224
<div className={demoLabel}>Warning (solid)</div>
222225
<Warning solid size={demoSize} />
223226
</td>
224-
<td />
227+
<td>
228+
<div className={demoLabel}>Bars</div>
229+
<Bars size={demoSize} />
230+
</td>
231+
<td>
232+
<div className={demoLabel}>User</div>
233+
<User size={demoSize} />
234+
</td>
235+
<td>
236+
<div className={demoLabel}>Shopping Cart</div>
237+
<ShoppingCart size={demoSize} />
238+
</td>
225239
</tr>
226240
</tbody>
227241
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React, { PureComponent } from 'react'
2+
import PropTypes from 'prop-types'
3+
import { calcIconSize, baseClassname } from '../utils'
4+
5+
const iconBase = {
6+
width: 44,
7+
height: 44,
8+
}
9+
10+
class ShoppingCart extends PureComponent {
11+
render() {
12+
const { color, size, block } = this.props
13+
const newSize = calcIconSize(iconBase, size)
14+
15+
return (
16+
<svg
17+
className={`${baseClassname('shopping-cart')} ${block ? 'db' : ''}`}
18+
width={newSize.width}
19+
height={newSize.height}
20+
viewBox="0 0 32 30"
21+
fill="none"
22+
xmlns="http://www.w3.org/2000/svg"
23+
>
24+
<path
25+
d="M8 30C9.65685 30 11 28.6569 11 27C11 25.3431 9.65685 24 8 24C6.34315 24 5 25.3431 5 27C5 28.6569 6.34315 30 8 30Z"
26+
fill={color}
27+
/>
28+
<path
29+
d="M27 30C28.6569 30 30 28.6569 30 27C30 25.3431 28.6569 24 27 24C25.3431 24 24 25.3431 24 27C24 28.6569 25.3431 30 27 30Z"
30+
fill={color}
31+
/>
32+
<path
33+
d="M28 22H7C6.505 22 6.084 21.638 6.011 21.148L3.139 2H0V0H4C4.495 0 4.916 0.362 4.989 0.852L5.611 5H31C31.3 5 31.583 5.134 31.773 5.366C31.963 5.597 32.039 5.902 31.98 6.196L28.98 21.196C28.887 21.664 28.477 22 28 22Z"
34+
fill={color}
35+
/>
36+
</svg>
37+
)
38+
}
39+
}
40+
41+
ShoppingCart.defaultProps = {
42+
color: 'currentColor',
43+
size: 20,
44+
block: false,
45+
}
46+
47+
ShoppingCart.propTypes = {
48+
color: PropTypes.string,
49+
size: PropTypes.number,
50+
block: PropTypes.bool,
51+
}
52+
53+
export default ShoppingCart

react/components/icon/User/index.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React, { PureComponent } from 'react'
2+
import PropTypes from 'prop-types'
3+
import { calcIconSize, baseClassname } from '../utils'
4+
5+
const iconBase = {
6+
width: 44,
7+
height: 44,
8+
}
9+
10+
class User extends PureComponent {
11+
render() {
12+
const { color, size, block } = this.props
13+
const newSize = calcIconSize(iconBase, size)
14+
15+
return (
16+
<svg
17+
className={`${baseClassname('user')} ${block ? 'db' : ''}`}
18+
width={newSize.width}
19+
height={newSize.height}
20+
viewBox="0 0 32 32"
21+
fill="none"
22+
xmlns="http://www.w3.org/2000/svg"
23+
>
24+
<path
25+
d="M16 0C7.17733 0 0 7.17733 0 16C0 24.8227 7.17733 32 16 32C24.8227 32 32 24.8227 32 16C32 7.17733 24.8227 0 16 0ZM24.9307 25.872C24.0453 23.2413 21.5973 21.3333 18.6667 21.3333H13.3333C10.4027 21.3333 7.95733 23.2427 7.072 25.8733C4.37467 23.432 2.66667 19.916 2.66667 16C2.66667 8.648 8.648 2.66667 16 2.66667C23.352 2.66667 29.3333 8.648 29.3333 16C29.3333 19.9147 27.6267 23.4307 24.9307 25.872Z"
26+
fill={color}
27+
/>
28+
<path
29+
d="M15.9998 6.66699C13.0545 6.66699 10.6665 9.05499 10.6665 12.0003V13.3337C10.6665 16.279 13.0545 18.667 15.9998 18.667C18.9452 18.667 21.3332 16.279 21.3332 13.3337V12.0003C21.3332 9.05499 18.9452 6.66699 15.9998 6.66699Z"
30+
fill={color}
31+
/>
32+
</svg>
33+
)
34+
}
35+
}
36+
37+
User.defaultProps = {
38+
color: 'currentColor',
39+
size: 20,
40+
block: false,
41+
}
42+
43+
User.propTypes = {
44+
color: PropTypes.string,
45+
size: PropTypes.number,
46+
block: PropTypes.bool,
47+
}
48+
49+
export default User

0 commit comments

Comments
 (0)