diff --git a/packages/foundations/scripts/local/generate-icon-font.ts b/packages/foundations/scripts/local/generate-icon-font.ts index 44f9f385403..b7e819906dc 100644 --- a/packages/foundations/scripts/local/generate-icon-font.ts +++ b/packages/foundations/scripts/local/generate-icon-font.ts @@ -1,11 +1,12 @@ import generateIconFonts from '@db-ui/gif/dist/generate-icon-fonts'; -import { generateIconTypes } from './generate-icon-types'; +import { generateIconTypes } from './generate-icon-types.js'; const defaultBuildDir = './assets/icons'; const fontName = 'db-ux'; const run = async () => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call await generateIconFonts({ fontName, src: defaultBuildDir, diff --git a/packages/foundations/scripts/local/generate-icon-overview.ts b/packages/foundations/scripts/local/generate-icon-overview.ts index 6144d6447d6..dcfa7a9cb13 100644 --- a/packages/foundations/scripts/local/generate-icon-overview.ts +++ b/packages/foundations/scripts/local/generate-icon-overview.ts @@ -3,7 +3,7 @@ */ import { writeFileSync } from 'node:fs'; -import { ALL_ICONS } from '../public'; +import { ALL_ICONS } from '../public.js'; const generateIconOverview = () => { try { diff --git a/packages/foundations/scripts/local/generate-icon-types.ts b/packages/foundations/scripts/local/generate-icon-types.ts index b4fe4703b6b..dab57c9ba41 100644 --- a/packages/foundations/scripts/local/generate-icon-types.ts +++ b/packages/foundations/scripts/local/generate-icon-types.ts @@ -2,53 +2,54 @@ * This script can be used to update the icon type for all components using icons. */ -import { writeFileSync, readFileSync } from "node:fs"; +import { writeFileSync, readFileSync } from 'node:fs'; export type GenerateIconTypesProps = { - fontJsonPath: string; - outDir: string; + fontJsonPath: string; + outDir: string; }; export const generateIconTypes = ({ - fontJsonPath, - outDir, + fontJsonPath, + outDir }: GenerateIconTypesProps) => { - try { - const allIcons: Record = JSON.parse( - readFileSync(fontJsonPath, "utf8") - ); - - const icons = Object.keys(allIcons); - - const generatedDisclaimer = "/* This file was generated */\n"; - const iconTypes = `${generatedDisclaimer}export type IconTypes = string |\n ${icons - .map((icon) => `"${icon}"`) - .join("|\n")};`; - const allIconsFile = `${generatedDisclaimer}export const ALL_ICONS: string[] = ${JSON.stringify( - icons - )};`; - - const filesToWrite = [ - { - name: "icon-types", - content: iconTypes, - }, - { - name: "all-icons", - content: allIconsFile, - }, - ]; - - for (const { name, content } of filesToWrite) { - writeFileSync(`${outDir}/${name}.ts`, content); - } - - let indexContent = filesToWrite - .map(({ name }) => `export * from "./${name}";`) - .join("\n"); - - writeFileSync(`${outDir}/index.ts`, indexContent); - } catch (e) { - console.error(e); - } + try { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const allIcons: Record = JSON.parse( + readFileSync(fontJsonPath, 'utf8') + ); + + const icons = Object.keys(allIcons); + + const generatedDisclaimer = '/* This file was generated */\n'; + const iconTypes = `${generatedDisclaimer}export type IconTypes = string |\n ${icons + .map((icon) => `"${icon}"`) + .join('|\n')};`; + const allIconsFile = `${generatedDisclaimer}export const ALL_ICONS: string[] = ${JSON.stringify( + icons + )};`; + + const filesToWrite = [ + { + name: 'icon-types', + content: iconTypes + }, + { + name: 'all-icons', + content: allIconsFile + } + ]; + + for (const { name, content } of filesToWrite) { + writeFileSync(`${outDir}/${name}.ts`, content); + } + + const indexContent = filesToWrite + .map(({ name }) => `export * from "./${name}";`) + .join('\n'); + + writeFileSync(`${outDir}/index.ts`, indexContent); + } catch (error) { + console.error(error); + } }; diff --git a/showcases/next-showcase/pages/_app.tsx b/showcases/next-showcase/pages/_app.tsx index d18402a9172..d0bdf26749b 100644 --- a/showcases/next-showcase/pages/_app.tsx +++ b/showcases/next-showcase/pages/_app.tsx @@ -47,10 +47,16 @@ const App = ({ Component, pageProps }: AppProps) => { } secondaryAction={ <> - + Profile - + Notification { } secondaryAction={ <> - + Profile - + Notification { - Airplane Button + + Airplane Button + Cancel Button Long Button Label with a lot of text @@ -323,7 +325,9 @@ const FormComponent = () => { Another Button Label with a lot of text - + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, diff --git a/showcases/react-showcase/src/components/header/index.tsx b/showcases/react-showcase/src/components/header/index.tsx index 29613aaab5d..ca93fdd2867 100644 --- a/showcases/react-showcase/src/components/header/index.tsx +++ b/showcases/react-showcase/src/components/header/index.tsx @@ -62,10 +62,7 @@ const getHeader = ({ Notification - + Help diff --git a/showcases/react-showcase/src/components/page/index.tsx b/showcases/react-showcase/src/components/page/index.tsx index 1e1cc3b4ba2..2ff5a28aa2c 100644 --- a/showcases/react-showcase/src/components/page/index.tsx +++ b/showcases/react-showcase/src/components/page/index.tsx @@ -51,10 +51,7 @@ const getPage = ({ Notification - + Help