From 3ccf4371b0060a2dc90feae6c949a7f4ca164e2e Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Tue, 24 Dec 2024 13:42:42 +0530 Subject: [PATCH 1/6] updating list item and list components in ADS --- .../ads/src/List/List.stories.tsx | 39 +++---- .../ads/src/List/List.styles.tsx | 92 ++++++++-------- .../design-system/ads/src/List/List.tsx | 102 ++++++------------ .../design-system/ads/src/List/List.types.tsx | 12 +-- .../Editor/Explorer/Actions/ActionEntity.tsx | 42 ++++---- .../pages/Editor/Explorer/ExplorerIcons.tsx | 4 +- 6 files changed, 130 insertions(+), 161 deletions(-) diff --git a/app/client/packages/design-system/ads/src/List/List.stories.tsx b/app/client/packages/design-system/ads/src/List/List.stories.tsx index 160b027f7d81..573aa5318fba 100644 --- a/app/client/packages/design-system/ads/src/List/List.stories.tsx +++ b/app/client/packages/design-system/ads/src/List/List.stories.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { List, ListItem, Icon } from "@appsmith/ads"; +import { List, ListItem, Icon, Button } from "@appsmith/ads"; import type { StoryObj } from "@storybook/react"; import type { ListItemProps, ListProps } from "@appsmith/ads"; @@ -79,15 +79,21 @@ const ListItemArgTypes = { }, }, }, - endIcon: { - control: "text", - description: "The icon to display at the end of the list item", + rightControl: { + description: "The control to display at the end of the list item", table: { type: { - summary: "string", + summary: "ReactNode", }, }, }, + rightContolVisibility: { + description: + "`always` type will show the right control always. `hover` type will show the right control only when the list item is hovered.", + control: "radio", + options: ["always", "hover"], + defaultValue: "always", + }, description: { control: "text", description: "Description text to be shown alongside the title", @@ -140,14 +146,6 @@ const ListItemArgTypes = { }, }, }, - onEndIconClick: { - description: "callback for when the end icon is clicked", - table: { - type: { - summary: "() => void", - }, - }, - }, }; function ListItemTemplate(args: JSX.IntrinsicAttributes & ListItemProps) { @@ -163,7 +161,8 @@ ListItemLargeStory.args = { description: "inline", descriptionType: "inline", size: "lg", - endIcon: "add-more", + rightControl: , + rightControlVisibility: "hover", }; export const ListItemErrorStory = ListItemTemplate.bind({}) as StoryObj; @@ -215,10 +214,12 @@ ListItemOverflowStory.args = { title: "Action item 1 Action item 1 Action item 1 Action item 1", }; -export const ListItemEndIconStory = ListItemTemplate.bind({}) as StoryObj; -ListItemEndIconStory.storyName = "List item end icon"; -ListItemEndIconStory.argTypes = ListItemArgTypes; -ListItemEndIconStory.args = { +export const ListItemRightControlStory = ListItemTemplate.bind({}) as StoryObj; +ListItemRightControlStory.storyName = "List item right control"; +ListItemRightControlStory.argTypes = ListItemArgTypes; +ListItemRightControlStory.args = { title: "Action item 1", - endIcon: "add-more", + rightControl: ( +