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

Commit 0d969eb

Browse files
author
Alexandru Buliga
authored
fix(menu): iconOnly does not overlap big icons (#486)
* fix(menu): iconOnly does not overlap big icons * - fixed focus styles - added changelog
1 parent 043b46f commit 0d969eb

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2222
- Fix incorrect and missing filled or outline versions of Teams SVG icons @codepretty ([#552](https://github.com/stardust-ui/react/pull/552))
2323
- Fix truncate styles in Teams team for the `Button`'s `content` prop used as element @mnajdova ([#551](https://github.com/stardust-ui/react/pull/551))
2424
- Fix HTML preview in the editor @layershifter ([#555](https://github.com/stardust-ui/react/pull/555))
25+
- Fix icon overlapping for `iconOnly` prop in `Menu` component with @Bugaa92 ([#486](https://github.com/stardust-ui/react/pull/486))
2526

2627
### Features
2728
- Add `render` callback as an option for shorthand value @kuzhelov ([#519](https://github.com/stardust-ui/react/pull/519))

src/themes/teams/components/Menu/menuItemStyles.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,16 @@ const pointingBeak: ComponentSlotStyleFunction<MenuItemPropsAndState, MenuVariab
121121

122122
const menuItemStyles: ComponentSlotStylesInput<MenuItemPropsAndState, MenuVariables> = {
123123
wrapper: ({ props, variables: v, theme }): ICSSInJSStyle => {
124-
const { active, isFromKeyboard, pills, pointing, secondary, underlined, vertical } = props
124+
const {
125+
active,
126+
iconOnly,
127+
isFromKeyboard,
128+
pills,
129+
pointing,
130+
secondary,
131+
underlined,
132+
vertical,
133+
} = props
125134

126135
return {
127136
color: v.defaultColor,
@@ -155,7 +164,6 @@ const menuItemStyles: ComponentSlotStylesInput<MenuItemPropsAndState, MenuVariab
155164

156165
...(pointing &&
157166
vertical && {
158-
border: '1px solid transparent',
159167
borderTopLeftRadius: `${pxToRem(3)}`,
160168
borderTopRightRadius: `${pxToRem(3)}`,
161169
...(pointing === 'end'
@@ -164,6 +172,10 @@ const menuItemStyles: ComponentSlotStylesInput<MenuItemPropsAndState, MenuVariab
164172
marginBottom: `${pxToRem(12)}`,
165173
}),
166174

175+
...(iconOnly && {
176+
display: 'flex',
177+
}),
178+
167179
...itemSeparator({ props, variables: v, theme }),
168180

169181
// active styles
@@ -194,16 +206,16 @@ const menuItemStyles: ComponentSlotStylesInput<MenuItemPropsAndState, MenuVariab
194206
display: 'block',
195207
cursor: 'pointer',
196208

209+
...(((pointing && vertical) || iconOnly) && { border: '1px solid transparent' }),
210+
197211
...(underlined
198212
? { padding: `${pxToRem(4)} 0` }
199213
: pointing && vertical
200214
? { padding: `${pxToRem(8)} ${pxToRem(18)}` }
201215
: { padding: `${pxToRem(14)} ${pxToRem(18)}` }),
202216

203217
...(iconOnly && {
204-
width: v.iconsMenuItemSize,
205-
height: v.iconsMenuItemSize || '100%',
206-
padding: 0,
218+
padding: pxToRem(8),
207219
display: 'flex',
208220
alignItems: 'center',
209221
justifyContent: 'center',

src/themes/teams/components/Menu/menuStyles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default {
1111
const { iconOnly, fluid, pointing, pills, primary, underlined, vertical } = props
1212
return {
1313
display: 'flex',
14+
...(iconOnly && { alignItems: 'center' }),
1415
...(vertical && {
1516
flexDirection: 'column',
1617
...(!fluid && { width: pxToRem(200) }),

src/themes/teams/components/Menu/menuVariables.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export interface MenuVariables {
1616
primaryHoverBorderColor: string
1717
primaryUnderlinedBorderColor: string
1818

19-
iconsMenuItemSize?: string
2019
circularRadius: string
2120
lineHeightBase: string
2221
}
@@ -38,7 +37,6 @@ export default (siteVars: any): MenuVariables => {
3837
primaryHoverBorderColor: siteVars.gray08,
3938
primaryUnderlinedBorderColor: siteVars.gray08,
4039

41-
iconsMenuItemSize: pxToRem(32),
4240
circularRadius: pxToRem(999),
4341
lineHeightBase: siteVars.lineHeightBase,
4442
}

0 commit comments

Comments
 (0)