Skip to content

Commit

Permalink
fix(theme): add missing shadow to action menus/dropdowns that uses th…
Browse files Browse the repository at this point in the history
…e Popover component (#146)

Signed-off-by: Christoph Jerolimov <[email protected]>
  • Loading branch information
christoph-jerolimov authored Dec 9, 2024
1 parent 08d898e commit 5ff9b79
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions workspaces/theme/.changeset/fifty-hotels-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-theme': patch
---

add missing shadow to action menus/dropdowns that uses the Popover component
1 change: 1 addition & 0 deletions workspaces/theme/plugins/theme/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface RHDHThemePalette {
disabledBackground: string;
paperBackgroundImage: string;
paperBorderColor: string;
popoverBoxShadow: string;
cardBackgroundColor: string;
cardBorderColor: string;
headerBottomBorderColor: string;
Expand Down
3 changes: 3 additions & 0 deletions workspaces/theme/plugins/theme/src/darkTheme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ describe('customDarkTheme', () => {
paperBackgroundImage: 'none',
paperBorderColor: '#A3A3A3',

popoverBoxShadow:
'0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.48), 0 0 0.25rem 0 rgba(3, 3, 3, 0.24)',

cardBackgroundColor: '#1b1d21',
cardBorderColor: '#A3A3A3',

Expand Down
4 changes: 4 additions & 0 deletions workspaces/theme/plugins/theme/src/darkTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const customDarkTheme = (): ThemeConfigPalette => {
paperBackgroundImage: 'none',
paperBorderColor: '#A3A3A3',

// Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)
popoverBoxShadow:
'0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.48), 0 0 0.25rem 0 rgba(3, 3, 3, 0.24)',

cardBackgroundColor: '#1b1d21',
cardBorderColor: '#A3A3A3',

Expand Down
3 changes: 3 additions & 0 deletions workspaces/theme/plugins/theme/src/lightTheme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ describe('customLightTheme', () => {
paperBackgroundImage: 'none',
paperBorderColor: '#C7C7C7',

popoverBoxShadow:
'0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)',

cardBackgroundColor: '#FFF',
cardBorderColor: '#C7C7C7',

Expand Down
4 changes: 4 additions & 0 deletions workspaces/theme/plugins/theme/src/lightTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export const customLightTheme = (): ThemeConfigPalette => {
paperBackgroundImage: 'none',
paperBorderColor: '#C7C7C7',

// Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)
popoverBoxShadow:
'0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)',

cardBackgroundColor: '#FFF',
cardBorderColor: '#C7C7C7',

Expand Down
2 changes: 2 additions & 0 deletions workspaces/theme/plugins/theme/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface RHDHThemePalette {
paperBackgroundImage: string;
paperBorderColor: string;

popoverBoxShadow: string;

cardBackgroundColor: string;
cardBorderColor: string;

Expand Down
11 changes: 11 additions & 0 deletions workspaces/theme/plugins/theme/src/utils/createComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ export const createComponents = (themeConfig: ThemeConfig): Components => {
elevation0: noElevationStyle,
},
};
components.MuiPopover = {
styleOverrides: {
paper: {
// Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)
boxShadow: general.popoverBoxShadow,
// `Popover` has no outline by default, but since we're adding it to the `Paper`
// components, this ensures that the `Popover` doesn't has a shadow and an outline.
outline: 0,
},
},
};

// Required for MUI v4, not MUI v5
const elevations = Array.from(
Expand Down

0 comments on commit 5ff9b79

Please sign in to comment.