Closed bangarang closed 2 months ago
The recent updates across several files enhance the flexibility of attaching stylesheets in a React application by introducing the attachStyleSheet
function, which comes with new configuration options. The core logic has been moved and centralized into a utility module, while components using these styles have been updated to adopt the new approach.
File Path | Change Summary |
---|---|
apps/react/app/App.tsx |
Removed attachStyleSheet call with a custom nonce. |
apps/react/app/page.tsx |
Added styleSheetOptions with a nonce value to the FlatfileProvider configuration. |
packages/react/src/components/FlatfileProvider.tsx |
Imported attachStyleSheet and added logic to conditionally attach a stylesheet based on config options. |
packages/react/src/index.ts |
Removed imports of stylesheet and styleInject , and refactored attachStyleSheet to no longer be exported. |
packages/react/src/types/iFrameProps.ts |
Added StyleSheetOptions import and added styleSheetOptions property to IFrameTypes . |
packages/react/src/utils/attachStyleSheet.ts |
Introduced attachStyleSheet function for attaching a stylesheet using options like insertAt and nonce . |
packages/react/src/types/iFrameProps.ts (1)
`2-2`: **Ensure `StyleSheetOptions` is well-documented.** The import of `StyleSheetOptions` looks good, but ensure that its properties and usage are well-documented for clarity.packages/react/src/components/FlatfileProvider.tsx (2)
`22-22`: **Ensure `attachStyleSheet` is tested.** The import statement for `attachStyleSheet` looks good. Ensure that the function is well-tested to handle various scenarios. --- `221-226`: **Verify the `useEffect` dependency array.** The `useEffect` dependency array includes `styleSheetRef`, which is a ref and will not trigger re-renders. Ensure this is the intended behavior.