Skip to content

Commit

Permalink
Admin Generator (Future): Fix the default width of "actions" columns (#…
Browse files Browse the repository at this point in the history
…2489)

When there are exactly two icon buttons inside the actions cell, which
is the default for generated grids, it should be 84px wide. If more
actions are added, the width needs to be adjusted manually anyway, see
the existing (future generator) `ProductsGrid`.
  • Loading branch information
jamesricky authored Aug 30, 2024
1 parent c130adc commit e39dd31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/admin/src/products/ManufacturersGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export function ManufacturersGrid() {
headerName: "",
sortable: false,
filterable: false,
pinned: "right",
width: 84,
renderCell: (params) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export function ManufacturersGrid(): React.ReactElement {
type: "actions",
align: "right",
pinned: "right",
width: 84,
renderCell: (params) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export function ProductVariantsGrid({ product }: Props): React.ReactElement {
type: "actions",
align: "right",
pinned: "right",
width: 84,
renderCell: (params) => {
return (
<>
Expand Down
2 changes: 2 additions & 0 deletions packages/admin/cms-admin/src/generator/future/generateGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export function generateGrid(
type: actionsColumnType,
headerName: actionsColumnHeaderName,
pinned: actionsColumnPinned = "right",
width: actionsColumnWidth = 84,
...restActionsColumnConfig
} = actionsColumnConfig ?? {};

Expand Down Expand Up @@ -547,6 +548,7 @@ export function generateGrid(
type: '"actions"',
align: '"right"',
pinned: `"${actionsColumnPinned}"`,
width: actionsColumnWidth,
...restActionsColumnConfig,
renderCell: `(params) => {
return (
Expand Down

0 comments on commit e39dd31

Please sign in to comment.