This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
feat(Dropdown): update styles for dark and hc Teams themes #1299
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3f1afc2
-added variables for dark theme
97ceb67
-updated HC theme
b44665e
-fixed searable border radius when dropdown is opened
c6d815a
-fixed hover state of the HC dropdown
fe4ba01
-fixed selected items
f2dd80e
-fixed focus + active color for trigger button in HC theme
f718c5a
Merge branch 'master' into feat/dropdown-theming
255e126
-resolved color palette updates
6a0c73d
-fixing issues
7d9e869
-added selected prop on the Dropdown Item
53d6488
Merge branch 'master' into feat/dropdown-theming
149b18e
-added focus border
9a76c37
-implemented focused styles on the items
77dfafb
-added tests for different themes
2245c94
Merge branch 'master' into feat/dropdown-theming
0bfb9fe
-extracted isFromKeyboard set state in a separate function call
067071c
-added focused state
8448866
-fixed HC hover styles dependening on the open prop
051fe6d
-reverting Flex Item changes
864a046
-fixed multiple + selection scenario
366653c
-added dropdown item className on the list item element
bbb3144
-used the border focus styles inside the dropdown item
bef6128
-fixing handlers in the Dropdown's trigger button
0a9c072
-fixed focusing style on the dropdown
b40ab6a
-updated list box shadow
dd7f58d
Merge branch 'master' into feat/dropdown-theming
afdcc8a
-addressed PR comments
a1c26b6
-added shadowLevel3 in dark theme, and used this value for the list b…
9463f34
Merge branch 'master' into feat/dropdown-theming
0c26c47
-updated changelog
bac1c5e
-addressed PR comments
b039e21
-rename consts used in the renderTriggerButton method
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/react/src/themes/teams-dark/components/Dropdown/dropdownVariables.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { DropdownVariables } from '../../../teams/components/Dropdown/dropdownVariables' | ||
|
|
||
| export default (siteVars): Partial<DropdownVariables> => ({ | ||
| backgroundColor: siteVars.colors.grey[650], | ||
| backgroundColorHover: siteVars.colors.grey[550], | ||
| borderColor: 'transparent', | ||
| borderColorFocus: siteVars.colors.brand[400], | ||
| color: siteVars.colors.grey[250], | ||
| selectedItemColor: siteVars.colors.grey[250], | ||
| listBackgroundColor: siteVars.colors.grey[650], | ||
| listItemBackgroundColor: siteVars.colors.grey[650], | ||
| listItemColorHover: siteVars.colors.white, | ||
| listItemBackgroundColorHover: siteVars.colors.grey[550], | ||
| listItemBackgroundColorActive: siteVars.colors.grey[550], | ||
| listItemColorActive: siteVars.colors.white, | ||
| selectedItemBackgroundColor: siteVars.colors.grey[650], | ||
| selectedItemColorFocus: siteVars.colors.grey[700], // check this value | ||
| listItemSelectedColor: siteVars.colors.white, | ||
| selectedItemBackgroundColorFocus: siteVars.colors.brand[200], | ||
| triggerButtonColorHover: siteVars.colors.grey[250], | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/react/src/themes/teams-high-contrast/componentStyles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export { default as Attachment } from './components/Attachment/attachmentStyles' | ||
| export { default as MenuItem } from './components/Menu/menuItemStyles' | ||
| export { default as Alert } from './components/Alert/alertStyles' | ||
| export { default as Dropdown } from './components/Dropdown/dropdownStyles' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/react/src/themes/teams-high-contrast/components/Dropdown/dropdownStyles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types' | ||
| import { | ||
| default as Dropdown, | ||
| DropdownProps, | ||
| DropdownState, | ||
| } from '../../../../components/Dropdown/Dropdown' | ||
| import { DropdownVariablesHC } from './dropdownVariables' | ||
|
|
||
| type DropdownPropsAndState = DropdownProps & DropdownState | ||
|
|
||
| const transparentColorStyle: ICSSInJSStyle = { | ||
| backgroundColor: 'transparent', | ||
| borderColor: 'transparent', | ||
| borderBottomColor: 'transparent', | ||
| } | ||
|
|
||
| const dropdownStyles: ComponentSlotStylesInput<DropdownPropsAndState, DropdownVariablesHC> = { | ||
| container: ({ props: p, variables: v }): ICSSInJSStyle => ({ | ||
| ...(!p.open && { | ||
| ':hover': { | ||
| backgroundColor: v.backgroundColorHover, | ||
| borderColor: v.borderColorHover, | ||
| [`& .${Dropdown.slotClassNames.triggerButton}`]: { | ||
| color: v.triggerButtonColorHover, | ||
| }, | ||
| }, | ||
| }), | ||
| }), | ||
|
|
||
| triggerButton: ({ props: p, variables: v }): ICSSInJSStyle => ({ | ||
| ':hover': { | ||
| ...transparentColorStyle, | ||
| color: v.triggerButtonColorHover, | ||
| }, | ||
| ':focus': { | ||
| color: v.color, | ||
| ':active': { | ||
| color: v.color, | ||
| }, | ||
| }, | ||
| }), | ||
| } | ||
|
|
||
| export default dropdownStyles |
32 changes: 32 additions & 0 deletions
32
packages/react/src/themes/teams-high-contrast/components/Dropdown/dropdownVariables.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { DropdownVariables } from '../../../teams/components/Dropdown/dropdownVariables' | ||
| import { pxToRem } from '../../../../lib' | ||
|
|
||
| export interface DropdownVariablesHC extends DropdownVariables { | ||
| borderColorHover: string | ||
| } | ||
|
|
||
| export default (siteVars): Partial<DropdownVariablesHC> => ({ | ||
| backgroundColor: siteVars.colors.black, | ||
| borderColor: siteVars.colors.white, | ||
| borderRadius: pxToRem(3), | ||
| borderWidth: `1px`, | ||
| backgroundColorHover: siteVars.colors.black, | ||
| borderColorHover: siteVars.accessibleYellow, | ||
| borderColorFocus: siteVars.accessibleCyan, | ||
| color: siteVars.colors.white, | ||
| selectedItemColor: siteVars.colors.white, | ||
| listBackgroundColor: siteVars.colors.black, | ||
| listBorderColor: siteVars.colors.white, | ||
| listBoxShadow: undefined, | ||
| listBorderWidth: '1px', | ||
| listItemBackgroundColor: siteVars.colors.black, | ||
| listItemColorHover: siteVars.colors.black, | ||
| listItemBackgroundColorHover: siteVars.accessibleYellow, | ||
| listItemBackgroundColorActive: siteVars.accessibleYellow, | ||
| listItemColorActive: siteVars.colors.black, | ||
| listItemSelectedColor: siteVars.accessibleCyan, | ||
| selectedItemBackgroundColor: siteVars.colors.black, | ||
| selectedItemColorFocus: siteVars.colors.black, | ||
| selectedItemBackgroundColorFocus: siteVars.accessibleYellow, | ||
| triggerButtonColorHover: siteVars.colors.white, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is another good example of why we should refrain from blindly passing all calculated props to any slot's content - we might imagine what it would be if regular
<button />, or even any other Stardust component type which is different fromButtonwill be provided here