Skip to content

Commit

Permalink
feat(core/presentation): add <Illustration/>, supporting files (#8336)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Munson committed Jun 9, 2020
1 parent a7cd1a5 commit 89641f6
Show file tree
Hide file tree
Showing 14 changed files with 508 additions and 437 deletions.
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>
);
});
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;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Illustration';

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 89641f6

Please sign in to comment.