Skip to content

Commit

Permalink
feat(plate): subAddons slot, on/off border&shadow&borderRadius, new v…
Browse files Browse the repository at this point in the history
…iew 'custom' (#158)

* feat: subAddons slot, on/of border&shadow&borderRadis, new view 'custom'

* fix: element alignment, rework subAddons render

* refactor: rework buttons render

* chore: update screenshots

* fix: fix alignment children withoout title and any addons

* fix: component padding

* docs(plate): update docs

* fix(plate): fix jumping component on border turn off/on

* docs: fix regexp for css-vars block (#161)

* fix(plate): fix otline

* refactor(plate): buttonList components for render Buttons, ds

* fix(plate): update screenshots

* fix(plate): fix defautlt buttons margins, rect plate in docs

* fix(plate): fix test

* fix(plate): use variable for left border

Co-authored-by: Developer <developer@MacBook-Pro-som-tillhor-admin.local>
Co-authored-by: EGNKupava <62112300+EGNKupava@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 12, 2022
1 parent be5c1a1 commit b2fc570
Show file tree
Hide file tree
Showing 26 changed files with 507 additions and 230 deletions.
4 changes: 4 additions & 0 deletions .storybook/public/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -862,3 +862,7 @@ table.docblock-argstable tbody.docblock-argstable-body td div:only-child span {
border-color: var(--color-light-border-secondary);
background: var(--color-light-bg-secondary);
}

.plateGlobal {
--plate-background: url('./images/docs-background.png');
}
Binary file added .storybook/public/images/docs-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/alert/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type AlertProps = Omit<PlateProps, 'foldable' | 'defaultFolded' | 'leftAd
export const Alert: FC<AlertProps> = ({ className, title, ...restProps }) => (
<Plate
className={cn(styles.component, className)}
buttonsClassName={styles.buttons}
contentClassName={styles.content}
title={title ? <span className={styles.title}>{title}</span> : null}
rounded={false}
limitContentWidth={false}
{...restProps}
/>
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions packages/alert/src/index.module.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
@import '../../themes/src/default.css';

.component {
border-radius: var(--border-radius-xs) 0 0 var(--border-radius-xs);
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left-width: 2px;
padding-top: var(--gap-s);
padding-bottom: var(--gap-s);
padding-right: var(--gap-s);
min-height: 48px;
}

.buttons {
margin-top: var(--gap-m);
}

.title {
@mixin accent_primary_medium;
}

.content {
max-width: none;
}
20 changes: 11 additions & 9 deletions packages/plate/src/Component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Plate', () => {
expect(getByTestId(dataTestId).tagName).toBe('DIV');
});

it('should render buttons size=xs, first view=outlined, others view=link', () => {
it('should render buttons size=xxs, first view=secondary, others view=link', () => {
const { queryByTestId } = render(
<Plate
buttons={[
Expand All @@ -49,28 +49,30 @@ describe('Plate', () => {
expect(queryByTestId('button-2')).toBeInTheDocument();
expect(queryByTestId('button-3')).toBeInTheDocument();

expect(queryByTestId('button-1')).toHaveClass('xs');
expect(queryByTestId('button-2')).toHaveClass('xs');
expect(queryByTestId('button-3')).toHaveClass('xs');
expect(queryByTestId('button-1')).toHaveClass('xxs');
expect(queryByTestId('button-2')).toHaveClass('xxs');
expect(queryByTestId('button-3')).toHaveClass('xxs');

expect(queryByTestId('button-1')).toHaveClass('outlined');
expect(queryByTestId('button-1')).toHaveClass('secondary');
expect(queryByTestId('button-2')).toHaveClass('link');
expect(queryByTestId('button-3')).toHaveClass('link');
});

describe('Classes tests', () => {
it('should set `className` class', () => {
const className = 'test-class';
const { container } = render(<Plate className={className} />);
const dataTestId = 'test-id';
const { getByTestId } = render(<Plate className={className} dataTestId={dataTestId} />);

expect(container.firstElementChild).toHaveClass(className);
expect(getByTestId(dataTestId)).toHaveClass(className);
});

it('should set `positive` class if `view` prop is `positive`', () => {
const view = 'positive';
const { container } = render(<Plate view={view} />);
const dataTestId = 'test-id';
const { getByTestId } = render(<Plate view={view} dataTestId={dataTestId} />);

expect(container.firstElementChild).toHaveClass(view);
expect(getByTestId(dataTestId)).toHaveClass(view);
});
});

Expand Down
Loading

0 comments on commit b2fc570

Please sign in to comment.