Skip to content

Commit

Permalink
OPHJOD-1010: Update storybook to 8.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
juhaniko committed Nov 7, 2024
1 parent 2c62987 commit 65c8a26
Show file tree
Hide file tree
Showing 7 changed files with 4,591 additions and 4,475 deletions.
10 changes: 10 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,33 @@ const config: StorybookConfig = {
titlePrefix: 'Components',
},
],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
'@storybook/addon-themes',
'@storybook/addon-designs',
'@storybook/addon-mdx-gfm',
'@chromatic-com/storybook',
],

framework: {
name: '@storybook/react-vite',
options: {},
},

core: {
disableTelemetry: true,
},

docs: {
defaultName: 'Documentation',
},

typescript: {
reactDocgen: 'react-docgen-typescript',
},
};
export default config;
3 changes: 3 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const preview: Preview = {
},
},
},

decorators: [
withThemeByClassName<ReactRenderer>({
themes: {
Expand All @@ -67,6 +68,8 @@ const preview: Preview = {
defaultTheme: 'light',
}),
],

tags: ['autodocs'],
};

export default preview;
5 changes: 1 addition & 4 deletions lib/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Placement } from '@floating-ui/react';
import React from 'react';
import { TooltipContext } from './TooltipContext';
import { useTooltip } from './utils';

export interface TooltipOptions {
Expand All @@ -13,10 +14,6 @@ export interface TooltipProps extends TooltipOptions {
children?: React.ReactNode;
}

type ContextType = ReturnType<typeof useTooltip> | null;

export const TooltipContext = React.createContext<ContextType>(null);

/** Tooltips show contextual help or information about specific components when a user hovers or focuses on them. */
export function Tooltip({ children, ...options }: TooltipProps) {
const tooltip = useTooltip(options);
Expand Down
6 changes: 6 additions & 0 deletions lib/components/Tooltip/TooltipContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import { useTooltip } from './utils';

// Separate file for TooltipContext to avoid ESLint "Fast refresh" error
type ContextType = ReturnType<typeof useTooltip> | null;
export const TooltipContext = React.createContext<ContextType>(null);
3 changes: 2 additions & 1 deletion lib/components/Tooltip/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
useRole,
} from '@floating-ui/react';
import React from 'react';
import { TooltipContext, TooltipOptions } from './Tooltip';
import { TooltipOptions } from './Tooltip';
import { TooltipContext } from './TooltipContext';

export const ARROW_HEIGHT = 12;
export const GAP = 0;
Expand Down
Loading

0 comments on commit 65c8a26

Please sign in to comment.