diff --git a/.changeset/young-flies-think.md b/.changeset/young-flies-think.md new file mode 100644 index 000000000..0b66556f2 --- /dev/null +++ b/.changeset/young-flies-think.md @@ -0,0 +1,5 @@ +--- +'@aragon/gov-ui-kit': minor +--- + +Implement `ActionSimulation` component diff --git a/src/core/components/dropdown/dropdownContainer/dropdownContainer.stories.tsx b/src/core/components/dropdown/dropdownContainer/dropdownContainer.stories.tsx index 263356769..e306c9ad0 100644 --- a/src/core/components/dropdown/dropdownContainer/dropdownContainer.stories.tsx +++ b/src/core/components/dropdown/dropdownContainer/dropdownContainer.stories.tsx @@ -33,6 +33,29 @@ export const Default: Story = { }, }; +/** + * DropdownContainer component with a variant. + */ +export const WithVariant: Story = { + render: (props: IDropdownContainerProps) => ( + + First item + Second item + Third item with a longer label + + ), + args: { + label: 'Dropdown', + variant: 'secondary', + }, + argTypes: { + variant: { + control: { type: 'select' }, + options: ['primary', 'secondary', 'tertiary'], + }, + }, +}; + export const OnlyIcon: Story = { render: (props: IDropdownContainerProps) => ( diff --git a/src/core/components/dropdown/dropdownContainer/dropdownContainer.tsx b/src/core/components/dropdown/dropdownContainer/dropdownContainer.tsx index b4d06f232..f684e702c 100644 --- a/src/core/components/dropdown/dropdownContainer/dropdownContainer.tsx +++ b/src/core/components/dropdown/dropdownContainer/dropdownContainer.tsx @@ -1,7 +1,7 @@ import * as RadixDropdown from '@radix-ui/react-dropdown-menu'; import classNames from 'classnames'; import { useEffect, useState, type ComponentProps, type ReactNode } from 'react'; -import { Button, type IButtonProps } from '../../button'; +import { Button, type ButtonVariant, type IButtonProps } from '../../button'; import { IconType } from '../../icon'; export interface IDropdownContainerProps extends Omit, 'dir'> { @@ -62,6 +62,11 @@ export interface IDropdownContainerProps extends Omit, 'di * Additional classnames for the dropdown container (e.g. for setting a max width for the dropdown items). */ contentClassNames?: string; + /** + * Variant of the dropdown. + * @default tertiary + */ + variant?: ButtonVariant; } export const DropdownContainer: React.FC = (props) => { @@ -80,6 +85,7 @@ export const DropdownContainer: React.FC = (props) => { constrainContentWidth = true, constrainContentHeight = true, contentClassNames, + variant = 'tertiary', ...otherProps } = props; @@ -103,7 +109,7 @@ export const DropdownContainer: React.FC = (props) => { {customTrigger ?? ( + )} + + + + {error && ( +
+ + {error} +
+ )} + + ); +}; diff --git a/src/modules/components/action/actionSimulation/index.ts b/src/modules/components/action/actionSimulation/index.ts new file mode 100644 index 000000000..731ad9a38 --- /dev/null +++ b/src/modules/components/action/actionSimulation/index.ts @@ -0,0 +1,2 @@ +export { ActionSimulation } from './actionSimulation'; +export type { IActionSimulationProps, IActionSimulationRun } from './actionSimulation.api'; diff --git a/src/modules/components/action/index.ts b/src/modules/components/action/index.ts new file mode 100644 index 000000000..cdef3090d --- /dev/null +++ b/src/modules/components/action/index.ts @@ -0,0 +1 @@ +export * from './actionSimulation'; diff --git a/src/modules/components/index.ts b/src/modules/components/index.ts index aa2ecb3eb..1d2cf0f43 100644 --- a/src/modules/components/index.ts +++ b/src/modules/components/index.ts @@ -1,3 +1,4 @@ +export * from './action'; export * from './address'; export * from './asset'; export * from './dao';