Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/use app name array to find app icon #600

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/amplify-components",
"version": "7.10.1",
"version": "7.10.2",
"description": "Frontend Typescript components for the Amplify team",
"main": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
Expand Down
35 changes: 21 additions & 14 deletions src/components/Icons/ApplicationIcon/ApplicationIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,31 @@ export type ApplicationName =
| 'premo';

interface ApplicationIconData {
appName: string;
appName: string[];
component: ForwardRefExoticComponent<
AppIconProps & RefAttributes<HTMLDivElement>
>;
}
const apps: ApplicationIconData[] = [
{ appName: 'portal', component: Portal },
{ appName: 'acquire', component: Acquire },
{ appName: '4dinsight', component: FourDInsight },
{ appName: 'dasha', component: Dasha },
{ appName: 'orca', component: Orca },
{ appName: 'logging-qualification', component: LoggingQualification },
{ appName: 'recap', component: Recap },
{ appName: 'pwex', component: Pwex },
{ appName: 'inpress', component: InPress },
{ appName: 'bravos', component: Bravos },
{ appName: 'premo', component: Premo },
{ appName: ['portal'], component: Portal },
{ appName: ['acquire'], component: Acquire },
{ appName: ['4dinsight'], component: FourDInsight },
{ appName: ['dasha'], component: Dasha },
{ appName: ['orca'], component: Orca },
{
appName: ['logging-qualification', 'logging qualification'],
component: LoggingQualification,
},
{ appName: ['recap'], component: Recap },
{ appName: ['pwex'], component: Pwex },
{ appName: ['inpress'], component: InPress },
{ appName: ['bravos'], component: Bravos },
{ appName: ['premo'], component: Premo },
];

export interface ApplicationIconProps extends Partial<AppIconProps> {
type OptionalAppIconProps = Partial<AppIconProps>;

export interface ApplicationIconProps extends OptionalAppIconProps {
name: ApplicationName | string;
}

Expand All @@ -56,7 +61,9 @@ const ApplicationIcon = forwardRef<HTMLDivElement, ApplicationIconProps>(
{ name, size = 48, iconOnly = false, withHover = false, grayScale = false },
ref
) => {
const appData = apps.find((app) => app.appName === name.toLowerCase());
const appData = apps.find((app) =>
app.appName.includes(name.toLowerCase())
);

if (appData === undefined)
return (
Expand Down