Skip to content

Commit

Permalink
chore<Table>: Header layout (#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor authored Jul 1, 2024
1 parent 89048e4 commit 8af4f99
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 20 deletions.
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

0 comments on commit 8af4f99

Please sign in to comment.