Skip to content

Commit

Permalink
Delete definition of PlaceholderEmptyIconType
Browse files Browse the repository at this point in the history
  • Loading branch information
spli02 committed Oct 29, 2024
1 parent 58d98e2 commit 96c5809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ export const SmallWithFolderIcon: Story = {
name: 'Small with folder icon',
args: {
size: 'small',
iconType: 'folder',
icon: 'folder',
},
};

export const SmallWithFileIcon: Story = {
name: 'Small with file icon',
args: {
size: 'small',
iconType: 'file',
icon: 'file',
},
};

export const SmallWithFileErrorIcon: Story = {
name: 'Small with file error icon',
args: {
size: 'small',
iconType: 'file-error',
icon: 'file-error',
},
};
19 changes: 3 additions & 16 deletions src/components/graphics/PlaceholderEmpty/PlaceholderEmpty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@

import * as React from 'react';
import { classNames as cx, type ComponentProps } from '../../../util/componentUtil.ts';
import { assertUnreachable } from '../../../util/types.ts';

import { Icon } from '../Icon/Icon.tsx';
import { Icon, type IconName } from '../Icon/Icon.tsx';

import cl from './PlaceholderEmpty.module.scss';

export { cl as PlaceholderEmptyClassNames };

export type PlaceholderEmptyIconType = 'graph' | 'folder' | 'file' | 'file-error';

export type PlaceholderEmptySize = 'large' | 'small';

export type PlaceholderEmptyProps = React.PropsWithChildren<ComponentProps<'div'> & {
Expand All @@ -25,7 +22,7 @@ export type PlaceholderEmptyProps = React.PropsWithChildren<ComponentProps<'div'
size?: undefined | PlaceholderEmptySize,

/** An icon type of this component. Defaults to "graph". */
iconType?: undefined | PlaceholderEmptyIconType,
icon?: undefined | IconName,

/** A custom icon of this component. */
customIcon?: undefined | React.ReactNode,
Expand All @@ -46,7 +43,7 @@ export const PlaceholderEmpty = (props: PlaceholderEmptyProps) => {
const {
unstyled = false,
size = 'large',
iconType = 'graph',
icon = 'graph',
customIcon = null,
title = '',
subtitle = '',
Expand All @@ -55,16 +52,6 @@ export const PlaceholderEmpty = (props: PlaceholderEmptyProps) => {
...propsRest
} = props;

const icon = ((): PlaceholderEmptyIconType => {
switch (iconType) {
case 'graph': return 'graph';
case 'folder': return 'folder';
case 'file': return 'file';
case 'file-error': return 'file-error';
default: throw assertUnreachable(iconType);
}
})();

return (
<div
{...propsRest}
Expand Down

0 comments on commit 96c5809

Please sign in to comment.