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

chore<Table>: Header layout #1685

Merged
merged 3 commits into from
Jul 1, 2024
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
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.
19 changes: 19 additions & 0 deletions src/components/Table/__tests__/Table.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

import {test} from '~playwright/core';

import {TableStories} from './helpersPlaywright';

test.describe('Table', () => {
test('render story: <Default>', async ({mount, expectScreenshot}) => {
await mount(<TableStories.Default />);

await expectScreenshot();
});

test('render story: <HOCWithTableSorting>', async ({mount, expectScreenshot}) => {
await mount(<TableStories.HOCWithTableSorting />);

await expectScreenshot();
});
});
5 changes: 5 additions & 0 deletions src/components/Table/__tests__/helpersPlaywright.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {composeStories} from '@storybook/react';

import * as DefaultTableStories from '../__stories__/Table.stories';

export const TableStories = composeStories(DefaultTableStories);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ import React from 'react';
import {ArrowDown, ArrowUp, ArrowUpArrowDown} from '@gravity-ui/icons';

import {Icon} from '../../../../Icon';
import {block} from '../../../../utils/cn';

import './SortIndicator.scss';

export interface SortIndicatorProps {
order?: 'asc' | 'desc';
}

const b = block('sort-indicator');

export function SortIndicator({order}: SortIndicatorProps) {
let icon;
switch (order) {
Expand All @@ -26,9 +21,5 @@ export function SortIndicator({order}: SortIndicatorProps) {
icon = ArrowUpArrowDown;
}

return (
<div className={b()}>
<Icon data={icon} size={14} className={b('icon')} />
</div>
);
return <Icon data={icon} size={14} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $block: '.#{variables.$ns}table';
#{$block} {
&__sort {
display: inline-flex;
align-items: baseline;
align-items: center;
gap: var(--g-spacing-1);
// `top` to avoid redundant height to appear
vertical-align: top;
Expand All @@ -14,6 +14,7 @@ $block: '.#{variables.$ns}table';
border-radius: var(--g-border-radius-xs);

&-indicator {
display: flex;
flex-shrink: 0;
color: var(--g-color-text-hint);
}
Expand Down
Loading