Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 820ca9a

Browse files
priyankar205kuzhelov
authored andcommitted
feat(Icons): Added icon for add-page and also added missing icon sizes (#601)
* Adding icon and more sizes * Moving add page from processed to exported * Adding sizeModifier for large size in teams theme * Addressing code comments * simplify changes * simplify changes * adjust changelog entry
1 parent 206da99 commit 820ca9a

File tree

5 files changed

+49
-9
lines changed

5 files changed

+49
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
4444
- Label Processed Teams icons moved to Stardust theme @kuzhelov ([#574](https://github.com/stardust-ui/react/pull/574))
4545
- Add `Dropdown` component @silviuavram ([#422](https://github.com/stardust-ui/react/pull/422))
4646
- Export `call-recording` SVG icon @Bugaa92 ([#585](https://github.com/stardust-ui/react/pull/585))
47+
- Export `canvas-add-page` SVG icon @priyankar205 ([#601](https://github.com/stardust-ui/react/pull/601))
48+
- Add `sizeModifier` variable (with `x` and `xx` values) to `Icon`'s Teams theme styles @priyankar205 ([#601](https://github.com/stardust-ui/react/pull/601))
4749

4850
### Documentation
4951
- Add `prettier` support throughout the docs @levithomason ([#568](https://github.com/stardust-ui/react/pull/568))

src/themes/teams/components/Icon/iconStyles.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,24 @@ const getDefaultFontIcon = (iconName: string) => {
2424
}
2525

2626
const getFontStyles = (
27-
size: string,
27+
size: number,
2828
iconName: string,
2929
themeIcon?: ResultOf<FontIconSpec>,
3030
): ICSSInJSStyle => {
3131
const { fontFamily, content } = themeIcon || getDefaultFontIcon(iconName)
32+
const sizeInRems = pxToRem(size)
3233

3334
return {
3435
fontFamily,
35-
fontSize: getSize(size),
36+
fontSize: sizeInRems,
3637
lineHeight: 1,
3738
textAlign: 'center',
3839

3940
'::before': {
4041
content,
4142
display: 'block',
42-
width: getSize(size),
43-
height: getSize(size),
43+
width: sizeInRems,
44+
height: sizeInRems,
4445
},
4546
}
4647
}
@@ -71,7 +72,19 @@ const getPaddedStyle = (): ICSSInJSStyle => ({
7172
padding: pxToRem(4),
7273
})
7374

74-
const getSize = size => pxToRem(sizes.get(size))
75+
const getIconSize = (size, sizeModifier): number => {
76+
if (!sizeModifier) {
77+
return sizes.get(size)
78+
}
79+
const modifiedSizes = {
80+
large: {
81+
x: 24,
82+
xx: 28,
83+
},
84+
}
85+
86+
return modifiedSizes[size] && modifiedSizes[size][sizeModifier]
87+
}
7588

7689
const getIconColor = color => color || 'currentColor'
7790

@@ -91,8 +104,7 @@ const iconStyles: ComponentSlotStylesInput<IconProps, any> = {
91104
speak: 'none',
92105
verticalAlign: 'middle',
93106

94-
...(isFontBased &&
95-
getFontStyles(size, name, callable(iconSpec && (iconSpec.icon as FontIconSpec))())),
107+
...(isFontBased && getFontStyles(getIconSize(size, v.sizeModifier), name)),
96108

97109
...(isFontBased && {
98110
color: getIconColor(v.color),
@@ -128,10 +140,12 @@ const iconStyles: ComponentSlotStylesInput<IconProps, any> = {
128140
},
129141

130142
svg: ({ props: { size, disabled }, variables: v }): ICSSInJSStyle => {
143+
const iconSizeInRems = pxToRem(getIconSize(size, v.sizeModifier))
144+
131145
return {
132146
display: 'block',
133-
width: getSize(size),
134-
height: getSize(size),
147+
width: iconSizeInRems,
148+
height: iconSizeInRems,
135149
fill: getIconColor(v.color),
136150

137151
...(disabled && {

src/themes/teams/components/Icon/svg/ProcessedIcons/icons-canvas-addpage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export default {
1818
</svg>
1919
),
2020
styles: {},
21+
exportedAs: 'canvas-add-page',
2122
} as TeamsProcessedSvgIconSpec
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react'
2+
import { TeamsProcessedSvgIconSpec } from '../types'
3+
4+
export default {
5+
icon: ({ classes }) => (
6+
<svg role="presentation" focusable="false" viewBox="8 8 16 16" className={classes.svg}>
7+
<g>
8+
<g className={classes.outlinePart}>
9+
<path d="M11.5 23a.5.5 0 0 1-.5-.5V14h3.986V9.003c.005 0 .01-.003.014-.003h5.5a.5.5 0 0 1 .5.5V18h1V9.5c0-.827-.673-1.5-1.5-1.5H15c-.4 0-.777.156-1.083.463l-3.478 3.968A1.49 1.49 0 0 0 10 13.49V22.5c0 .827.673 1.5 1.5 1.5H17v-1h-5.5zm2.486-13.1V13H11.27l2.717-3.1z" />
10+
<path d="M23 21h-2v-2h-1v2h-2v1h2v2h1v-2h2z" />
11+
</g>
12+
<g className={classes.filledPart}>
13+
<path d="M23 21h-2v-2h-1v2h-2v1h2v2h1v-2h2z" />
14+
<path d="M16.5 21.5c0-2.206 1.794-4 4-4 .531 0 1.036.109 1.5.297V9.5c0-.827-.673-1.5-1.5-1.5H15l-.014.001V14H10v8.5c0 .827.673 1.5 1.5 1.5h5.903a3.96 3.96 0 0 1-.903-2.5z" />
15+
<path d="M13.986 13V8.405c-.022.021-.047.036-.069.058l-3.478 3.968a1.486 1.486 0 0 0-.35.569h3.897z" />
16+
</g>
17+
</g>
18+
</svg>
19+
),
20+
styles: {},
21+
} as TeamsProcessedSvgIconSpec

src/themes/teams/components/Icon/svg/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import callEnd from './callEnd'
1212
import callRecording from './callRecording'
1313
import callVideo from './callVideo'
1414
import callVideoOff from './callVideoOff'
15+
import canvasAddPage from './canvasAddPage'
1516
import edit from './edit'
1617
import error from './error'
1718
import fontColor from './fontColor'
@@ -50,6 +51,7 @@ export default {
5051
'call-control-present-new': callControlPresentNew,
5152
'call-control-stop-presenting-new': callControlStopPresentingNew,
5253
'call-recording': callRecording,
54+
'canvas-add-page': canvasAddPage,
5355
edit,
5456
error,
5557
format,

0 commit comments

Comments
 (0)