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: Improves the native filters UI/UX - iteration 2 #14753

Merged
merged 1 commit into from
May 24, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const addFilterSetFlow = async () => {
// check description
expect(screen.getByText('Filters (1)')).toBeInTheDocument();
expect(screen.getByText(FILTER_NAME)).toBeInTheDocument();

expect(screen.getAllByText('Last week').length).toBe(2);

// apply filters
Expand Down Expand Up @@ -304,7 +305,7 @@ describe('FilterBar', () => {

await addFilterFlow();

expect(screen.getByTestId(getTestId('apply-button'))).toBeDisabled();
expect(screen.getByTestId(getTestId('apply-button'))).toBeEnabled();
});

it('add and apply filter set', async () => {
Expand All @@ -317,6 +318,8 @@ describe('FilterBar', () => {

await addFilterFlow();

userEvent.click(screen.getByTestId(getTestId('apply-button')));

await addFilterSetFlow();

// change filter
Expand All @@ -340,6 +343,7 @@ describe('FilterBar', () => {
screen.getByTestId(getTestId('filter-set-wrapper')),
).not.toHaveAttribute('data-selected', 'true');
userEvent.click(screen.getByTestId(getTestId('filter-set-wrapper')));
userEvent.click(screen.getAllByText('Filters (1)')[1]);
expect(await screen.findByText('Last week')).toBeInTheDocument();
userEvent.click(screen.getByTestId(getTestId('apply-button')));
expect(screen.getByTestId(getTestId('apply-button'))).toBeDisabled();
Expand All @@ -355,6 +359,8 @@ describe('FilterBar', () => {

await addFilterFlow();

userEvent.click(screen.getByTestId(getTestId('apply-button')));

await addFilterSetFlow();

userEvent.click(screen.getByTestId(getTestId('filter-set-menu-button')));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,58 @@ export const FilterTabTitle = styled.span`
`;

const FilterTabsContainer = styled(LineEditableTabs)`
// extra selector specificity:
&.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
min-width: ${FILTER_WIDTH}px;
margin: 0 ${({ theme }) => theme.gridUnit * 2}px 0 0;
padding: ${({ theme }) => theme.gridUnit}px
${({ theme }) => theme.gridUnit * 2}px;

&:hover,
&-active {
color: ${({ theme }) => theme.colors.grayscale.dark1};
border-radius: ${({ theme }) => theme.borderRadius}px;
background-color: ${({ theme }) => theme.colors.secondary.light4};

.ant-tabs-tab-remove > svg {
color: ${({ theme }) => theme.colors.grayscale.base};
transition: all 0.3s;
${({ theme }) => `
height: 100%;

& > .ant-tabs-content-holder {
border-left: 1px solid ${theme.colors.grayscale.light2};
margin-right: ${theme.gridUnit * 4}px;
}
& > .ant-tabs-content-holder ~ .ant-tabs-content-holder {
border: none;
}

&.ant-tabs-left
> .ant-tabs-content-holder
> .ant-tabs-content
> .ant-tabs-tabpane {
padding-left: ${theme.gridUnit * 4}px;
margin-top: ${theme.gridUnit * 4}px;
}

.ant-tabs-nav-list {
padding-top: ${theme.gridUnit * 4}px;
padding-right: ${theme.gridUnit * 2}px;
padding-bottom: ${theme.gridUnit * 4}px;
padding-left: ${theme.gridUnit * 3}px;
}

// extra selector specificity:
&.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
min-width: ${FILTER_WIDTH}px;
margin: 0 ${theme.gridUnit * 2}px 0 0;
padding: ${theme.gridUnit}px
${theme.gridUnit * 2}px;

&:hover,
&-active {
color: ${theme.colors.grayscale.dark1};
border-radius: ${theme.borderRadius}px;
background-color: ${theme.colors.secondary.light4};

.ant-tabs-tab-remove > svg {
color: ${theme.colors.grayscale.base};
transition: all 0.3s;
}
}
}
}

.ant-tabs-tab-btn {
text-align: left;
justify-content: space-between;
text-transform: unset;
}
.ant-tabs-tab-btn {
text-align: left;
justify-content: space-between;
text-transform: unset;
}
`}
`;

type FilterTabsProps = {
Expand Down
Loading