Feat/performance-refactor-styled-component (#5516)
In this PR I'm optimizing a whole RecordTableCell in real conditions with a complex RelationFieldDisplay component : - Broke down getObjectRecordIdentifier into multiple utils - Precompute memoized function for getting chip data per field with useRecordChipDataGenerator() - Refactored RelationFieldDisplay - Use CSS modules where performance is needed instead of styled components - Create a CSS theme with global CSS variables to be used by CSS modules
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { useEffect } from 'react';
|
||||
import { ThemeProvider } from '@emotion/react';
|
||||
import { Preview } from '@storybook/react';
|
||||
import { useDarkMode } from 'storybook-dark-mode';
|
||||
@ -10,6 +11,11 @@ const preview: Preview = {
|
||||
const mode = useDarkMode() ? 'Dark' : 'Light';
|
||||
|
||||
const theme = mode === 'Dark' ? THEME_DARK : THEME_LIGHT;
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.className = mode === 'Dark' ? 'dark' : 'light';
|
||||
}, [mode]);
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<Story />
|
||||
|
||||
Reference in New Issue
Block a user