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(tablekit-core): add bare and disabled-bare, update info styling … #214

Merged
merged 1 commit into from
Dec 5, 2023
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
14 changes: 10 additions & 4 deletions system/core/src/components/InputAlert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from '@emotion/react';
export const element = 'span';
export const className = 'input-alert';

const variants = ['info', 'error', 'warning'] as const;
const variants = ['info', 'error', 'warning', 'bare', 'disabled'] as const;

export type InputAlertVariant = (typeof variants)[number];

Expand All @@ -28,13 +28,14 @@ export const baseStyles = css`
}

&[data-variant='error'],
&[data-variant='warning'] {
&[data-variant='warning'],
&[data-variant='info'] {
border-radius: var(--border-radius-small);
padding: var(--spacing-l2) var(--spacing-l3);
}

&[data-variant='info'] > svg:first-child {
color: var(--info);
&[data-variant='disabled'] {
color: var(--text-disabled);
}

&[data-variant='error'] {
Expand All @@ -46,4 +47,9 @@ export const baseStyles = css`
background: var(--warning-surface);
color: var(--warning-text);
}

&[data-variant='info'] {
background: var(--info-surface);
color: var(--info-text);
}
`;
16 changes: 10 additions & 6 deletions system/react-css/src/structuredComponents/InputAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ export interface Props extends inputAlert.Props {
children: React.ReactNode;
}

const inputAlertIconMap: Record<inputAlert.Props['data-variant'], JSX.Element> =
{
info: <Information size={16} />,
error: <WarningAltFilled size={16} />,
warning: <WarningAlt size={16} />
};
const inputAlertIconMap: Record<
inputAlert.Props['data-variant'],
JSX.Element | null
> = {
info: <Information size={16} />,
error: <WarningAltFilled size={16} />,
warning: <WarningAlt size={16} />,
bare: null,
disabled: null
};

export const InputAlert = React.forwardRef<
HTMLSpanElement,
Expand Down
16 changes: 10 additions & 6 deletions system/react/src/structuredComponents/InputAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ export const InputAlertInner = styled(inputAlert.element)<Props>`
${inputAlert.baseStyles}
`;

const inputAlertIconMap: Record<inputAlert.Props['data-variant'], JSX.Element> =
{
info: <Information size={16} />,
error: <WarningAltFilled size={16} />,
warning: <WarningAlt size={16} />
};
const inputAlertIconMap: Record<
inputAlert.Props['data-variant'],
JSX.Element | null
> = {
info: <Information size={16} />,
error: <WarningAltFilled size={16} />,
warning: <WarningAlt size={16} />,
bare: null,
disabled: null
};

export const InputAlert = React.forwardRef<
HTMLSpanElement,
Expand Down
4 changes: 3 additions & 1 deletion system/stories/src/InputAlert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import * as css from '@tablecheck/tablekit-react-css';
const contentVariants: emotion.InputAlertProps[] = [
{ id: '1', 'data-variant': 'info', children: 'Info' },
{ id: '2', 'data-variant': 'warning', children: 'Warning' },
{ id: '3', 'data-variant': 'error', children: 'Error' }
{ id: '3', 'data-variant': 'error', children: 'Error' },
{ id: '4', 'data-variant': 'bare', children: 'Bare' },
{ id: '5', 'data-variant': 'disabled', children: 'Disabled' }
];

export default {
Expand Down
Loading