-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
120 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
10 changes: 1 addition & 9 deletions
10
...napse-react-client/src/theme/useTheme.tsx → ...-react-client/src/theme/ThemeProvider.tsx
This file contains 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 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,2 +1,3 @@ | ||
export { defaultMuiThemeOptions } from './DefaultTheme' | ||
export * from './useTheme' | ||
export * from './ThemeProvider' | ||
export { mergeTheme } from './mergeTheme' |
4 changes: 2 additions & 2 deletions
4
...-client/src/utils/hooks/useTheme.test.tsx → ...eact-client/src/theme/mergeTheme.test.tsx
This file contains 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 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,11 @@ | ||
import { ThemeOptions } from '@mui/material' | ||
import type { PartialDeep } from 'type-fest' | ||
import { deepmerge } from '@mui/utils' | ||
import defaultMuiThemeOptions from './DefaultTheme' | ||
|
||
export function mergeTheme( | ||
themeOverrides: ThemeOptions | PartialDeep<ThemeOptions>, | ||
): ThemeOptions { | ||
// TODO: Handle merging color palettes where an entire palette can be generated from a single base color. | ||
return deepmerge(defaultMuiThemeOptions, themeOverrides) | ||
} |
This file contains 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
38 changes: 38 additions & 0 deletions
38
packages/synapse-react-client/stories/stubs/Tooltip/MuiTooltip.stories.tsx
This file contains 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,38 @@ | ||
import React from 'react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { Link } from '@mui/material' | ||
import { InfoTwoTone } from '@mui/icons-material' | ||
import { Tooltip } from './MuiTooltip' | ||
import { userEvent, within } from '@storybook/testing-library' | ||
|
||
const meta = { | ||
title: 'UI/MUI/Tooltip', | ||
component: Tooltip, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/0oPm5lLSUva8kyfVNMS6FA/Sage-Style-%26-Component-Library?node-id=187%3A6615', | ||
}, | ||
}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement) | ||
const tooltipAnchor = canvas.getByTestId('tooltipAnchor') | ||
await userEvent.hover(tooltipAnchor) | ||
}, | ||
} satisfies Meta | ||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Demo: Story = { | ||
name: 'Tooltip', | ||
args: { | ||
children: <InfoTwoTone data-testid={'tooltipAnchor'} />, | ||
title: ( | ||
<p> | ||
This is some text, and{' '} | ||
<Link href={'https://synapse.org/'}>here is a link</Link>. | ||
</p> | ||
), | ||
}, | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/synapse-react-client/stories/stubs/Tooltip/MuiTooltip.tsx
This file contains 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,9 @@ | ||
import React from 'react' | ||
import { | ||
Tooltip as MuiTooltip, | ||
TooltipProps as MuiTooltipProps, | ||
} from '@mui/material' | ||
|
||
export interface TooltipProps extends MuiTooltipProps {} | ||
|
||
export const Tooltip = (props: TooltipProps) => <MuiTooltip {...props} /> |