Skip to content

Commit

Permalink
Merge pull request #505 from dolittle/command-parameters-appearance
Browse files Browse the repository at this point in the history
Command parameters appearance
  • Loading branch information
N00bG1rl authored Feb 23, 2024
2 parents dc68499 + bd967d5 commit eca5ad0
Show file tree
Hide file tree
Showing 15 changed files with 428 additions and 308 deletions.
159 changes: 0 additions & 159 deletions Source/DesignSystem/helpers/DummyContents/DummyDataGridContent.tsx

This file was deleted.

1 change: 0 additions & 1 deletion Source/DesignSystem/helpers/DummyContents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@

export * from './DummyAccordionsContent';
export * from './DummyArray';
export * from './DummyDataGridContent';
export * from './DummyNavigationItems';
export * from './DummyText';
22 changes: 14 additions & 8 deletions Source/DesignSystem/molecules/DataGrid/DataGrid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import type { Meta, StoryObj } from '@storybook/react';

import { DataGridProProps } from '@mui/x-data-grid-pro';

import { dataTableDescription } from './helpers';
import { dummyColumns, dummyEditCellsColumns, dummyIconColumns, dummyIconRows, dummyRows } from '../../helpers/DummyContents';
import { dataTableDescription, dummyColumns, dummyIconRows, dummyRows, dummyEditCellColumns, dummyEditCellRows, dummyIconColumns } from './helpers';

import { DataGrid, dataGridDefaultProps } from './DataGrid';

Expand Down Expand Up @@ -63,8 +62,8 @@ export const Default: Story = {
columns: dummyColumns,
checkboxSelection: false,
loading: false,
onRowClick: () => action('onRowClick'),
onCellClick: () => action('onCellClick'),
onRowClick: action('Row Clicked!'),
onCellClick: action('Cell Clicked!'),
},
};

Expand All @@ -79,17 +78,24 @@ IconCells.parameters = {
docs: {
description: {
story: `Icon buttons is found inside their own column in the table that cause a specific action to a specific row of data.<br/>
Use Icon to display a specific icon in the table.`
Use Icon to display a specific status in the table.`
},
},
};

export const EditableCells: Story = {
args: {
...Default.args,
rows: dummyRows,
columns: dummyEditCellsColumns,
rows: dummyEditCellRows,
columns: dummyEditCellColumns,
experimentalFeatures: { newEditingApi: true },
sx: {
// Hack for secret cell active state. Otherwise size is going to be different.
'& .MuiOutlinedInput-root': {
'& .MuiSelect-select': { p: '5px 15px' },
'& fieldset': { border: 'none' },
},
},
},
};
EditableCells.parameters = {
Expand All @@ -112,7 +118,7 @@ EditableCells.parameters = {
// export const ScrollableDataGrid = () => {};
// export const RowEditMode = () => {};

// TODOS:
// TODO:
// Add into description what is needed in every Data Table.
// Add sorting guidance.
// Add alignment guidance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';

import { GridRenderCellParams, useGridApiContext } from '@mui/x-data-grid-pro';

import { TextField } from '@dolittle/design-system';
import { TextField } from '../../index';

const textFieldBorderStyles = {
'& .MuiOutlinedInput-root': {
Expand All @@ -21,7 +21,11 @@ const textFieldBorderStyles = {
},
};

export const EditTextFieldCell = (params: GridRenderCellParams<HTMLInputElement>) => {
// TODO: Gives an error at the moment.
/**
* Renders a editable text field cell in 'edit' mode in the DataGrid.
*/
export const DataGridEditCellEdit = (params: GridRenderCellParams<HTMLInputElement>) => {
const { id, value, field } = params;
const apiRef = useGridApiContext();

Expand All @@ -42,7 +46,10 @@ export const EditTextFieldCell = (params: GridRenderCellParams<HTMLInputElement>
);
};

export const EditCell = (params: GridRenderCellParams) =>
/**
* Renders a editable text field cell in the 'view' mode in the DataGrid.
*/
export const DataGridEditCellView = (params: GridRenderCellParams) =>
<TextField
value={params.value}
placeholder='Edit...'
Expand Down
35 changes: 35 additions & 0 deletions Source/DesignSystem/molecules/DataGrid/DataGridSelectCell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Aigonix. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import React from 'react';

import { GridRenderCellParams } from '@mui/x-data-grid-pro';

import { Button } from '../../index';

const styles = {
width: 1,
height: 1,
typography: 'body2',
textTransform: 'none',
};

/**
* These styles are required for DataGrid to make the select cell the same size as the other cells.
*/
// const styles = {
// // Hack for secret cell active state. Otherwise size is going to be different.
// '& .MuiOutlinedInput-root': {
// '& .MuiSelect-select': { p: '5px 15px' },
// '& fieldset': { border: 'none' },
// },
// };

// TODO: Styles should be moved to the theme.
// TODO: How to display the selected value label in the select cell?

/**
* Renders a select cell in 'view' mode in the DataGrid.
*/
export const DataGridSelectCellView = (params: GridRenderCellParams) =>
<Button label={params.value} color='subtle' endWithIcon='ArrowDropDownRounded' sx={styles} />;
Loading

0 comments on commit eca5ad0

Please sign in to comment.