Skip to content

Commit

Permalink
fix: addButtonPosition -> addButtonPlacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruminat committed Sep 2, 2024
1 parent 02d994f commit 14eeed5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions src/components/Reactions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ For more code examples go to [Reactions.stories.tsx](https://github.com/gravity-

**ReactionsProps** (main component props — Reactions' list):

| Property | Type | Required | Default | Description |
| :------------------ | :------------------------------------------ | :------: | :------ | :--------------------------------------------------------------------------------------------- |
| `addButtonPosition` | `'start' or 'end'` | | `'end'` | Position of the "Add reaction" button. |
| `className` | `string` | | | HTML `class` attribute |
| `hideAddButton` | `boolean` | | `false` | Should we hide the "Add reaction" button. |
| `onToggle` | `(value: string) => void` | | | Fires when a user clicks on a Reaction (in a Palette or in the Reactions' list) |
| `paletteProps` | `ReactionsPaletteProps` | `true` | | Notifications' palette props — it's a `Palette` component with available reactions to the user |
| `qa` | `string` | | | `qa` attribute for testing |
| `reactions` | `PaletteOption[]` | `true` | | List of all available reactions |
| `reactionsState` | `ReactionState[]` | `true` | | List of reactions that were used |
| `readOnly` | `boolean` | | `false` | readOnly state (usage example: only signed in users can react) |
| `renderTooltip` | `(state: ReactionState) => React.ReactNode` | | | Reaction's tooltip with the list of reacted users for example |
| `size` | `ButtonSize` | | `m` | Buttons's size |
| `style` | `React.CSSProperties` | | | HTML `style` attribute |
| Property | Type | Required | Default | Description |
| :------------------- | :------------------------------------------ | :------: | :------ | :--------------------------------------------------------------------------------------------- |
| `addButtonPlacement` | `'start' or 'end'` | | `'end'` | Position of the "Add reaction" button. |
| `className` | `string` | | | HTML `class` attribute |
| `hideAddButton` | `boolean` | | `false` | Should we hide the "Add reaction" button. |
| `onToggle` | `(value: string) => void` | | | Fires when a user clicks on a Reaction (in a Palette or in the Reactions' list) |
| `paletteProps` | `ReactionsPaletteProps` | `true` | | Notifications' palette props — it's a `Palette` component with available reactions to the user |
| `qa` | `string` | | | `qa` attribute for testing |
| `reactions` | `PaletteOption[]` | `true` | | List of all available reactions |
| `reactionsState` | `ReactionState[]` | `true` | | List of reactions that were used |
| `readOnly` | `boolean` | | `false` | readOnly state (usage example: only signed in users can react) |
| `renderTooltip` | `(state: ReactionState) => React.ReactNode` | | | Reaction's tooltip with the list of reacted users for example |
| `size` | `ButtonSize` | | `m` | Buttons's size |
| `style` | `React.CSSProperties` | | | HTML `style` attribute |

**ReactionState** (single reaction props):

Expand Down
8 changes: 4 additions & 4 deletions src/components/Reactions/Reactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface ReactionsProps extends Pick<PaletteProps, 'size'>, QAProps, DOM
*
* @default 'end'
*/
addButtonPosition?: 'start' | 'end';
addButtonPlacement?: 'start' | 'end';
/**
* Should we hide the "Add reaction" button.
*
Expand Down Expand Up @@ -86,7 +86,7 @@ export function Reactions({
paletteProps,
readOnly,
qa,
addButtonPosition = 'end',
addButtonPlacement = 'end',
hideAddButton = false,
renderTooltip,
onToggle,
Expand Down Expand Up @@ -166,7 +166,7 @@ export function Reactions({
}}
>
<Flex className={b(null, className)} style={style} gap={1} wrap={true} qa={qa}>
{!hideAddButton && addButtonPosition === 'start' ? addReactionButton : null}
{!hideAddButton && addButtonPlacement === 'start' ? addReactionButton : null}

{/* Reactions' list */}
{reactionsState.map((reaction) => {
Expand All @@ -184,7 +184,7 @@ export function Reactions({
);
})}

{!hideAddButton && addButtonPosition === 'end' ? addReactionButton : null}
{!hideAddButton && addButtonPlacement === 'end' ? addReactionButton : null}
</Flex>
</ReactionsContextProvider>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Reactions/__stories__/Reactions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ export const Size: StoryFn = () => {
);
};

export const AddButtonPosition: StoryFn = () => {
export const AddButtonPlacement: StoryFn = () => {
return (
<Flex direction="column" gap={4}>
<Flex direction="column" gap={2}>
<Text variant="subheader-1">Start</Text>
<Reactions {...useMockReactions()} addButtonPosition="start" />
<Reactions {...useMockReactions()} addButtonPlacement="start" />
</Flex>
<Flex direction="column" gap={2}>
<Text variant="subheader-1">End</Text>
<Reactions {...useMockReactions()} addButtonPosition="end" />
<Reactions {...useMockReactions()} addButtonPlacement="end" />
</Flex>
<Flex direction="column" gap={2}>
<Text variant="subheader-1">Hide</Text>
Expand Down

0 comments on commit 14eeed5

Please sign in to comment.