use-meta.tsx 373 B

1234567891011121314
  1. import type { Meta } from '@/utils/meta'
  2. type DeepPartial<T> = T extends object
  3. ? { [P in keyof T]?: DeepPartial<T[P]> }
  4. : T
  5. /**
  6. * Set values on window.metaAttributesCache, for use in Storybook stories
  7. */
  8. export const useMeta = (meta: DeepPartial<Meta>) => {
  9. for (const [key, value] of Object.entries(meta)) {
  10. window.metaAttributesCache.set(key, value)
  11. }
  12. }