Skip to content

Commit

Permalink
refactor(Table): Changed cell renderer config property name
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pinedo committed Nov 14, 2023
1 parent 91db330 commit 46e1462
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/table/src/core/Row/Row.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const colDefs: ColDef[] = [
id: 'booleanValue',
headerName: 'booleanValue',
type: 'tag',
tagConfig: {
cellRendererConfig: {
true: { color: '#1EC990', text: 'Active' },
false: { color: '#ED5353', text: 'Inactive' },
},
Expand All @@ -69,7 +69,7 @@ const colDefs: ColDef[] = [
id: 'status',
headerName: 'status',
type: 'tag',
tagConfig: {
cellRendererConfig: {
TODO: { color: '#1EC990', text: 'TODO' },
inProgress: { color: '#ED5353', text: 'inProgress' },
test: { color: 'orange', text: 'test' },
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface ColDef {
valueFormatter?: (value: unknown, context: DateContext) => void;

// revisar
tagConfig?: any;
cellRendererConfig?: any;
context?: {
[key: string]: unknown;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/editors/EditBoolean.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BooleanEditor: Story = {
headerName: 'booleanValue',
CellEditor: () => EditBoolean({ value: boolean, onChange }),
CellRenderer: TagRenderer,
tagConfig: {
cellRendererConfig: {
true: { color: '#1EC990', text: 'Active' },
false: { color: '#ED5353', text: 'Inactive' },
},
Expand Down
4 changes: 2 additions & 2 deletions packages/table/src/renderers/tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const columnBoolean: ColDef = {
id: 'booleanValue',
headerName: 'booleanValue',
type: 'tag',
tagConfig: {
cellRendererConfig: {
true: { color: '#1EC990', text: 'Active' },
false: { color: '#ED5353', text: 'Inactive' },
},
Expand All @@ -29,7 +29,7 @@ const columnStatus: ColDef = {
id: 'status',
headerName: 'status',
type: 'tag',
tagConfig: {
cellRendererConfig: {
TODO: { color: '#1EC990', text: 'TODO' },
inProgress: { color: '#ED5353', text: 'inProgress' },
test: { color: 'orange', text: 'test' },
Expand Down
6 changes: 3 additions & 3 deletions packages/table/src/renderers/tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface TagProps {
export const TagRenderer: React.FC<TagProps> = ({ value, columnDef }) => {
return (
<Tag
colorScheme={columnDef.tagConfig[value]?.color}
text={columnDef.tagConfig[value]?.text}
icon={columnDef.tagConfig[value]?.icon}
colorScheme={columnDef.cellRendererConfig[value]?.color}
text={columnDef.cellRendererConfig[value]?.text}
icon={columnDef.cellRendererConfig[value]?.icon}
/>
);
};
2 changes: 1 addition & 1 deletion packages/table/src/types/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const typeBoolean: ColumnType = {
id: 'tagBoolean',
CellRenderer: TagRenderer,
CellEditor: EditBoolean,
tagConfig: {
cellRendererConfig: {
true: { color: '#1EC990', text: 'Active' },
false: { color: '#ED5353', text: 'Inactive' },
},
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/types/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export type ColumnType = {
context?: {
[key: string]: unknown;
};
tagConfig?: { [key: string]: { color: string; text: string } };
cellRendererConfig?: { [key: string]: { color: string; text: string } };
};
2 changes: 1 addition & 1 deletion packages/table/src/types/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ColumnType } from './declarations';
export const typeTag: ColumnType = {
id: 'tag',
CellRenderer: TagRenderer,
tagConfig: {
cellRendererConfig: {
TODO: { color: '#1EC990', text: 'TODO' },
inProgress: { color: '#ED5353', text: 'inProgress' },
test: { color: 'orange', text: 'test' },
Expand Down

0 comments on commit 46e1462

Please sign in to comment.