Skip to content

Commit

Permalink
fix icon picker with updated webpack
Browse files Browse the repository at this point in the history
css-loader doesn't export the class names
to javascript if those are not css modules
but seems like there is no need for it anyhow
so I'm just dropping that import.
  • Loading branch information
petrjasek committed Feb 14, 2025
1 parent ebe415f commit a383bde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
15 changes: 5 additions & 10 deletions app-typescript/components/IconPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as React from 'react';
// @ts-ignore
import * as iconFont from '../../app/styles/_icon-font.scss';
import { Button } from './Button';
import { Icon } from './Icon';
import { IItem, SelectGrid } from "./SelectGrid";
Expand Down Expand Up @@ -85,7 +83,7 @@ export class IconPicker extends React.PureComponent<IProps, IState> {
}

const getIcons = (translateFunction: (text: string) => string): Array<IItem> => {
const translatedIconNameMap: any = {
const translatedIconNameMap = {
'add-gallery': 'Add Gallery',
'add-image': 'Add Image',
'adjust': 'Adjust',
Expand Down Expand Up @@ -271,11 +269,8 @@ const getIcons = (translateFunction: (text: string) => string): Array<IItem> =>
'zoom-out': 'Zoom Out',
};

return iconFont.icon
.split(', ')
.sort()
.map((icon: string) => ({
value: icon,
label: translatedIconNameMap[icon] ? translateFunction(translatedIconNameMap[icon]) : icon,
}));
return Object.keys(translatedIconNameMap).sort().map((icon) => ({
value: icon as keyof typeof translatedIconNameMap,
label: translateFunction(translatedIconNameMap[icon as keyof typeof translatedIconNameMap]),
}));
};
1 change: 1 addition & 0 deletions tasks/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = merge(webpackConfig, {
externals: [
'react',
'react-dom',
'angular',
],
});

0 comments on commit a383bde

Please sign in to comment.