Skip to content

Commit

Permalink
feat(LinkList): add useMargin prop and deprecate legacy
Browse files Browse the repository at this point in the history
useMargin should be used instead of legacy prop
  • Loading branch information
DSil committed Oct 9, 2024
1 parent eebd2de commit d6c98e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const meta: Meta<typeof LinkList> = {
args: {
direction: DIRECTIONS.ROW,
spacing: SPACINGS.FOUR_HUNDRED,
legacy: false,
useMargin: false,
indent: false,
},

Expand Down
2 changes: 1 addition & 1 deletion packages/orbit-components/src/LinkList/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Table below contains all types of the props available in LinkList component.
| direction | [`enum`](#enum) | `"column"` | The size of the LinkList. |
| indent | `boolean` | | Indenting LinkList item |
| spacing | [`spacing`](#spacing) | `"400"` | The spacing between LinkList children. |
| legacy | `boolean` | `false` | If `true` will use `margin` for spacing, if `false` will use `gap` |
| useMargin | `boolean` | `false` | If `true` will use `margin` for spacing, if `false` will use `gap` |

### enum

Expand Down
5 changes: 3 additions & 2 deletions packages/orbit-components/src/LinkList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { getDirectionClasses, getSpacingClasses } from "../common/tailwind";
const LinkList = ({
direction = "column",
indent,
legacy = false,
legacy,
useMargin = legacy,
spacing = SPACINGS.FOUR_HUNDRED,
children,
dataTest,
Expand All @@ -25,7 +26,7 @@ const LinkList = ({
"text-normal",
indent && "ps-100 p-0",
direction && getDirectionClasses(direction),
spacing && getSpacingClasses(spacing, undefined, direction, legacy),
spacing && getSpacingClasses(spacing, undefined, direction, useMargin),
)}
>
{React.Children.map(children, item => {
Expand Down
4 changes: 4 additions & 0 deletions packages/orbit-components/src/LinkList/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import type { Spacing } from "../Stack/types";
export interface Props extends Common.Globals {
readonly direction?: "column" | "row" | "row-reverse" | "column-reverse";
readonly indent?: boolean;
/**
* @deprecated This prop is deprecated. Use `useMargin` instead.
*/
readonly legacy?: boolean;
readonly useMargin?: boolean;
readonly spacing?: Spacing;
readonly children: React.ReactNode;
}

0 comments on commit d6c98e2

Please sign in to comment.