Skip to content

Commit

Permalink
fix(manager-react-components): update filters components css
Browse files Browse the repository at this point in the history
ref: MANAGER-15088

Signed-off-by: Alex Boungnaseng <[email protected]>
  • Loading branch information
aboungnaseng-ovhcloud committed Dec 3, 2024
1 parent 2f9eca4 commit ad69087
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
import React, { useState } from 'react';
import { ColumnSort } from '@tanstack/react-table';
import { withRouter } from 'storybook-addon-react-router-v6';
import { applyFilters, FilterCategories } from '@ovh-ux/manager-core-api';
import { applyFilters } from '@ovh-ux/manager-core-api';
import { useSearchParams } from 'react-router-dom';
import DataGridTextCell from './text-cell.component';
import { Datagrid } from './datagrid.component';
import { useColumnFilters } from '../filters';

interface Item {
label: string;
price: number;
}

const columsTmp = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
},
];

const columsFilters = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
comparator: FilterCategories.String,
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
comparator: FilterCategories.String,
},
];
import { columsTmp, columsFilters, Item } from './datagrid.mock';

const DatagridStory = ({
items,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const Datagrid = <T,>({
{isFilterable && (
<>
{columnsFilters.length > 0 && (
<div className="flex flex-row-reverse pb-[5px]">
<div className="flex flex-row-reverse py-[24px]">
<div id="datagrid-filter-popover-trigger">
<OdsButton
slot="datagrid-filter-popover-trigger"
Expand All @@ -211,7 +211,7 @@ export const Datagrid = <T,>({
</div>
)}
{filters?.filters.length > 0 && (
<div id="datagrid-filter-list" className="my-5">
<div id="datagrid-filter-list" className="mb-[24px]">
<FilterList
filters={filters.filters}
onRemoveFilter={filters.remove}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { DataGridTextCell } from './text-cell.component';
import { FilterCategories } from '@ovh-ux/manager-core-api';

Check failure on line 2 in packages/manager-react-components/src/components/datagrid/datagrid.mock.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

`@ovh-ux/manager-core-api` import should occur before import of `./text-cell.component`

Check failure on line 2 in packages/manager-react-components/src/components/datagrid/datagrid.mock.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

`@ovh-ux/manager-core-api` import should occur before import of `./text-cell.component`

export interface Item {
label: string;
price: number;
}

export const columsTmp = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
},
];

export const columsFilters = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
comparator: FilterCategories.String,
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
comparator: FilterCategories.String,
},
];
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
import React from 'react';
import { withRouter } from 'storybook-addon-react-router-v6';
import { useSearchParams } from 'react-router-dom';
import { FilterCategories, applyFilters } from '@ovh-ux/manager-core-api';
import { applyFilters } from '@ovh-ux/manager-core-api';
import { Datagrid } from './datagrid.component';
import { DataGridTextCell } from './text-cell.component';
import { useDatagridSearchParams } from './useDatagridSearchParams';
import { useColumnFilters } from '../filters';

interface Item {
label: string;
price: number;
}

const columsTmp = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
},
];

const columsFilters = [
{
id: 'label',
cell: (item: Item) => {
return <DataGridTextCell>{item.label}</DataGridTextCell>;
},
label: 'Label',
comparator: FilterCategories.String,
},
{
id: 'price',
cell: (item: Item) => {
return <DataGridTextCell>{item.price}</DataGridTextCell>;
},
label: 'Price',
comparator: FilterCategories.String,
},
];
import { columsTmp, columsFilters, Item } from './datagrid.mock';

function sortItems(
itemList: Item[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function FilterList({
<>
{filters?.map((filter, key) => (
<OdsTag
className="m-3"
className="mr-3"
color={ODS_TAG_COLOR.information}
size="lg"
key={key}
Expand Down

0 comments on commit ad69087

Please sign in to comment.