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

Commit 69cae74

Browse files
authored
fix(Menu): Adding dark & contrast themes for Menu toolbar (#708)
* adding more icons we need for MW & setting initial variable for icon to outline * menu bar is working for teams & teams dark themes * menu high contrast variables & styles * on hover/focus making the icons show filled state instead of outline * focus border is the correct size (30x30px) && high contrast menu styles are working * removed circularRadius from menuVariables since it is no longer used in the styles * removing explicit background & adding variable for iconOnlyActiveColor * fixed order of how styles get applied * add changelog entry * rename videoCameraEmphasis icon file * rename videoCameraEmphasis icon file * cleaned up styles * move changelog entry to the right spot... oops
1 parent 83c0019 commit 69cae74

File tree

22 files changed

+230
-66
lines changed

22 files changed

+230
-66
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3030
- Fix doc layout for Menu component @codepretty ([#695] https://github.com/stardust-ui/react/pull/695)
3131
- Fix focus outline visible only during keyboard navigation @kolaps33 ([#689] https://github.com/stardust-ui/react/pull/689)
3232
- Fix handling changes of `renderer` prop in `Provider` @layershifter ([#702](https://github.com/stardust-ui/react/pull/702))
33+
- Fix Menu themeing styles @codepretty ([#708](https://github.com/stardust-ui/react/pull/708))
3334
- Prevent infinite rendering loop start on `Popup` open @kuzhelov ([#705](https://github.com/stardust-ui/react/pull/705))
3435

3536
<!--------------------------------[ v0.16.1 ]------------------------------- -->

docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,64 @@ import { Menu, toolbarBehavior, toolbarButtonBehavior } from '@stardust-ui/react
33

44
const items = [
55
{
6-
key: 'cloud',
6+
key: 'format',
77
icon: {
8-
name: 'cloud',
9-
circular: true,
10-
size: 'small',
8+
name: 'format',
9+
variables: { outline: true },
1110
},
1211
accessibility: toolbarButtonBehavior,
13-
'aria-label': 'Cloud Tool',
12+
'aria-label': 'Format Tool',
1413
},
1514
{
16-
key: 'clock',
15+
key: 'paperclip',
1716
icon: {
18-
name: 'clock',
19-
circular: true,
20-
size: 'small',
17+
name: 'paperclip',
18+
variables: { outline: true },
2119
},
2220
accessibility: toolbarButtonBehavior,
23-
'aria-label': 'Clock Tool',
21+
'aria-label': 'Paperclip Tool',
22+
},
23+
{
24+
key: 'emoji',
25+
icon: {
26+
name: 'emoji',
27+
variables: { outline: true },
28+
},
29+
accessibility: toolbarButtonBehavior,
30+
'aria-label': 'Emoji Tool',
31+
},
32+
{
33+
key: 'giphy',
34+
icon: {
35+
name: 'giphy',
36+
variables: { outline: true },
37+
},
38+
accessibility: toolbarButtonBehavior,
39+
'aria-label': 'Giphy tool',
40+
},
41+
{
42+
key: 'sticker',
43+
icon: {
44+
name: 'sticker',
45+
variables: { outline: true },
46+
},
47+
accessibility: toolbarButtonBehavior,
48+
'aria-label': 'Sticker Tool',
49+
},
50+
{
51+
key: 'meetup',
52+
icon: {
53+
name: 'video-camera-emphasis',
54+
variables: { outline: true },
55+
},
56+
accessibility: toolbarButtonBehavior,
57+
'aria-label': 'Meetup Tool',
2458
},
2559
{
2660
key: 'book',
2761
icon: {
2862
name: 'book',
29-
circular: true,
30-
size: 'small',
63+
variables: { outline: true },
3164
},
3265
accessibility: toolbarButtonBehavior,
3366
'aria-label': 'Book Tool',
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface MenuVariables {
2+
color: string
3+
}
4+
5+
export default (siteVars: any): MenuVariables => {
6+
return {
7+
color: siteVars.white,
8+
}
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as MenuItem } from './components/Menu/menuItemStyles'

src/themes/teams-high-contrast/componentVariables.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ export { default as Chat } from './components/Chat/chatVariables'
44
export { default as ChatMessage } from './components/Chat/chatMessageVariables'
55
export { default as Divider } from './components/Divider/dividerVariables'
66
export { default as Header } from './components/Header/headerVariables'
7-
87
export { default as Input } from './components/Input/inputVariables'
9-
8+
export { default as Menu } from './components/Menu/menuVariables'
109
export { default as Text } from './components/Text/textVariables'
1110
export { default as TreeTitle } from './components/Tree/treeTitleVariables'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types'
2+
import { MenuVariables } from './menuVariables'
3+
import { MenuItemProps, MenuItemState } from '../../../../components/Menu/MenuItem'
4+
5+
type MenuItemPropsAndState = MenuItemProps & MenuItemState
6+
7+
const menuItemStyles: ComponentSlotStylesInput<MenuItemPropsAndState, MenuVariables> = {
8+
wrapper: ({ props, variables }): ICSSInJSStyle => {
9+
const { iconOnly, isFromKeyboard } = props
10+
11+
return {
12+
...(iconOnly && {
13+
// focus styles
14+
...(isFromKeyboard && {
15+
color: variables.activeColor,
16+
background: variables.activeBackgroundColor,
17+
}),
18+
19+
// hover styles
20+
':hover': {
21+
color: variables.activeColor,
22+
background: variables.activeBackgroundColor,
23+
},
24+
}),
25+
}
26+
},
27+
28+
root: ({ props }): ICSSInJSStyle => {
29+
const { iconOnly, isFromKeyboard } = props
30+
31+
return {
32+
// focus styles
33+
...(isFromKeyboard &&
34+
iconOnly && {
35+
borderColor: 'transparent',
36+
}),
37+
}
38+
},
39+
}
40+
41+
export default menuItemStyles
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export interface MenuVariables {
2+
color: string
3+
activeColor: string
4+
activeBackgroundColor: string
5+
}
6+
7+
export default (siteVars: any): MenuVariables => {
8+
return {
9+
color: siteVars.white,
10+
activeColor: siteVars.black,
11+
activeBackgroundColor: siteVars.accessibleYellow,
12+
}
13+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import mergeThemes from '../../lib/mergeThemes'
22
import * as siteVariables from './siteVariables'
33
import * as componentVariables from './componentVariables'
4+
import * as componentStyles from './componentStyles'
45
import teams from '../teams'
56

6-
export default mergeThemes(teams, { siteVariables, componentVariables })
7+
export default mergeThemes(teams, { siteVariables, componentVariables, componentStyles })

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export default {
1515
</svg>
1616
),
1717
styles: {},
18+
exportedAs: 'paperclip',
1819
} as TeamsProcessedSvgIconSpec

src/themes/teams/components/Icon/svg/ProcessedIcons/icons-call-meetup-filled.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)