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

Fix/support direction listview #158

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@the-deep/deep-ui",
"version": "1.5.14-beta.1",
"version": "1.5.14-beta.2",
"description": "React component library by Deep",
"files": [
"/build"
Expand Down
3 changes: 3 additions & 0 deletions src/components/Container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface Props {
headingContainerClassName?: HeaderProps['headingContainerClassName'];
inlineHeadingDescription?: boolean;
footerContentClassName?: string;
headingSectionClassName?: string;
footerActionsContainerClassName?: string;
footerIconsContainerClassName?: string;
footerQuickActionsContainerClassName?: string;
Expand Down Expand Up @@ -81,6 +82,7 @@ function Container(props: Props) {
footerClassName,
footerIconsContainerClassName,
footerActionsContainerClassName,
headingSectionClassName,
footerContentClassName,
footerQuickActionsContainerClassName,
containerElementProps,
Expand Down Expand Up @@ -136,6 +138,7 @@ function Container(props: Props) {
iconsContainerClassName={headerIconsContainerClassName}
actionsContainerClassName={headerActionsContainerClassName}
descriptionClassName={_cs(styles.headerDescription, headerDescriptionClassName)}
headingSectionClassName={headingSectionClassName}
headingClassName={headingClassName}
elementProps={headerElementProps}
headingContainerClassName={headingContainerClassName}
Expand Down
9 changes: 8 additions & 1 deletion src/components/ListView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const spacingToStyleMap: {
loose: styles.looseSpacing,
};

type MessagePropOmission = 'className' | 'message' | 'compact' | 'icon' | 'empty' | 'pendingContainerClassName';
type MessagePropOmission = 'className' | 'message'
| 'compact' | 'icon' | 'empty' | 'pendingContainerClassName' | 'messageHidden' | 'messageIconHidden';
export type Props<
D,
P,
Expand All @@ -33,6 +34,8 @@ export type Props<
compactAndVerticalEmptyMessage?: boolean;
compactPendingMessage?: boolean;
direction?: 'horizontal' | 'vertical';
messageShown?: boolean;
messageIconShown?: boolean;
};

function ListView<
Expand All @@ -59,6 +62,8 @@ function ListView<
compactAndVerticalEmptyMessage,
spacing = 'none',
direction = 'horizontal',
messageShown = false,
messageIconShown = false,
...otherListProps
} = props;

Expand Down Expand Up @@ -87,6 +92,8 @@ function ListView<
compactPendingMessage={empty || compactPendingMessage}
compact={compactEmptyMessage}
compactAndVertical={compactAndVerticalEmptyMessage}
messageHidden={!messageShown}
messageIconHidden={!messageIconShown}
/>
<List
data={data}
Expand Down
20 changes: 14 additions & 6 deletions src/components/Message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface Props {
compactAndVertical?: boolean;
compactPendingMessage?: boolean;
compactEmptyMessage?: boolean;
messageHidden?: boolean;
messageIconHidden?: boolean;
}

function Message(props: Props) {
Expand All @@ -44,6 +46,8 @@ function Message(props: Props) {
compactPendingMessage,
compactEmptyMessage,
compactAndVertical,
messageHidden = false,
messageIconHidden = false,
} = props;

if (pending) {
Expand Down Expand Up @@ -98,12 +102,16 @@ function Message(props: Props) {
compactAndVertical && styles.vertical,
)}
>
<div className={styles.iconContainer}>
{icon}
</div>
<div className={styles.content}>
{ message }
</div>
{!messageHidden && (
<div className={styles.iconContainer}>
{icon}
</div>
)}
{!messageIconHidden && (
<div className={styles.content}>
{ message }
</div>
)}
</div>
);
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/TableView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import Table, {
import Message, { Props as MessageProps } from '../Message';
import styles from './styles.css';

type MessagePropOmission = 'className' | 'message' | 'compact' | 'icon' | 'empty' | 'pendingContainerClassName';
type MessagePropOmission = 'className' | 'message'
| 'compact' | 'icon' | 'empty' | 'pendingContainerClassName' | 'messageHidden' | 'messageIconHidden';
export type Props<
D,
K extends string | number,
Expand All @@ -24,6 +25,8 @@ export type Props<
contentClassName?: string,
compactEmptyMessage?: boolean;
compactPendingMessage?: boolean;
messageShown?: boolean;
messageIconShown?: boolean;
};

function TableView<
Expand All @@ -47,6 +50,8 @@ function TableView<
contentClassName,
compactEmptyMessage,
compactPendingMessage,
messageShown = false,
messageIconShown = false,
...otherTableProps
} = props;

Expand Down Expand Up @@ -77,6 +82,8 @@ function TableView<
filteredEmptyMessage={filteredEmptyMessage}
compactPendingMessage={empty || compactPendingMessage}
compactEmptyMessage={compactEmptyMessage}
messageHidden={!messageShown}
messageIconHidden={!messageIconShown}
/>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions src/stories/ListView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ const Template: Story<ListViewProps<OptionFields, OptionProps, string, any, any>
{...args}
pending={pending}
filtered={filtered}
direction="vertical"
spacing="comfortable"
messageShown
messageIconShown
// eslint-disable-next-line react/destructuring-assignment
data={empty ? [] : args.data}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/stories/TableView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ const Template: Story<
// eslint-disable-next-line react/destructuring-assignment
data={empty ? [] : args.data}
columns={columns}
messageShown
messageIconShown
/>
</div>
</div>
Expand Down