-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core/presentation): add <Illustration/>, supporting files (#8336)
- Loading branch information
Erik Munson
committed
Jun 9, 2020
1 parent
a7cd1a5
commit 89641f6
Showing
14 changed files
with
508 additions
and
437 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app/scripts/modules/core/src/presentation/illustrations/Illustration.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { memo } from 'react'; | ||
|
||
import { illustrationsByName } from './illustrationsByName'; | ||
|
||
export type IllustrationName = keyof typeof illustrationsByName; | ||
|
||
export interface IIllustrationProps { | ||
name: IllustrationName; | ||
} | ||
|
||
const throwInvalidIllustrationError = (name: string) => { | ||
throw new Error(`No illustration with the name ${name} exists`); | ||
}; | ||
|
||
export const Illustration = memo(({ name }: IIllustrationProps) => { | ||
const Component = illustrationsByName[name]; | ||
|
||
if (!Component) { | ||
throwInvalidIllustrationError(name); | ||
} | ||
|
||
return ( | ||
<div style={{ display: 'grid', gridTemplateColumns: '1fr', gridTemplateRows: '1fr' }}> | ||
<Component style={{ gridColumn: 1, gridRow: 1 }} /> | ||
</div> | ||
); | ||
}); |
9 changes: 9 additions & 0 deletions
9
app/scripts/modules/core/src/presentation/illustrations/illustrationsByName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ReactComponent as markArtifactVersionAsBad } from './vectors/markArtifactVersionAsBad.svg'; | ||
import { ReactComponent as pinArtifactVersion } from './vectors/pinArtifactVersion.svg'; | ||
import { ReactComponent as unpinArtifactVersion } from './vectors/unpinArtifactVersion.svg'; | ||
|
||
export const illustrationsByName = { | ||
markArtifactVersionAsBad, | ||
pinArtifactVersion, | ||
unpinArtifactVersion, | ||
} as const; |
1 change: 1 addition & 0 deletions
1
app/scripts/modules/core/src/presentation/illustrations/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Illustration'; |
43 changes: 0 additions & 43 deletions
43
...cripts/modules/core/src/presentation/illustrations/managedDeliveryMarkAsBad.svg
This file was deleted.
Oops, something went wrong.
92 changes: 0 additions & 92 deletions
92
app/scripts/modules/core/src/presentation/illustrations/managedDeliveryPause.svg
This file was deleted.
Oops, something went wrong.
105 changes: 0 additions & 105 deletions
105
app/scripts/modules/core/src/presentation/illustrations/managedDeliveryPin.svg
This file was deleted.
Oops, something went wrong.
89 changes: 0 additions & 89 deletions
89
app/scripts/modules/core/src/presentation/illustrations/managedDeliveryRun.svg
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.