Skip to content

Commit

Permalink
Merge release/v3.3.2 into main branch (#1269)
Browse files Browse the repository at this point in the history
* fix alignment of Option with checkbox and description (#1267)

* REC-25 add a new accordion alert component (#1268)
  • Loading branch information
github-actions[bot] authored Jul 16, 2024
1 parent a276bb9 commit 5cd7930
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@user-interviews/ui-design-system",
"version": "3.3.1",
"version": "3.3.2",
"dependencies": {
"@tiptap/core": "^2.4.0",
"@tiptap/extension-bold": "^2.4.0",
Expand Down
4 changes: 4 additions & 0 deletions src/Accordion/Accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ When multiple Cards are stacked, you want to ensure there is proper content alig
### Disabled

<Canvas of={ComponentStories.Disabled} />

### Alert

<Canvas of={ComponentStories.AccordionAlert} />
24 changes: 24 additions & 0 deletions src/Accordion/Accordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,27 @@ Disabled.args = {
helperText: 'helper text',
title: 'Accordion Toggle -- disabled',
};

export const AccordionAlert = (args) => (
<Accordion>
<AccordionItem borderless eventKey="0" variant="info">
<AccordionToggle
eventKey="0"
{...args}
/>
<AccordionCollapse eventKey="0" variant="info">
<div>
Add content here.
</div>
</AccordionCollapse>
</AccordionItem>
</Accordion>
);

AccordionAlert.args = {
chevronLateral: true,
chevronLeft: true,
disabled: false,
helperText: 'helper text',
title: 'Accordion Alert',
};
9 changes: 9 additions & 0 deletions src/Accordion/AccordionCollapse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@
&__container {
padding: 16px 24px;
}

&--info {
border-top: none !important;
color: var(--ux-gray-900);
}

&--noTopPadding {
padding-top: 0px !important;
}
}
17 changes: 15 additions & 2 deletions src/Accordion/AccordionCollapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import RBAccordionCollapse from 'react-bootstrap/AccordionCollapse';
import './AccordionCollapse.scss';

type AccordionCollapseProps = {
variant?: string;
children: React.ReactNode;
/**
A unique key used to control this item's collapse/expand.
Expand All @@ -16,6 +17,7 @@ type AccordionCollapseProps = {
};

const AccordionCollapse = ({
variant,
children,
eventKey,

Expand All @@ -25,17 +27,28 @@ const AccordionCollapse = ({
...props
}: AccordionCollapseProps) => (
<RBAccordionCollapse
className={classNames(UNSAFE_className, 'AccordionCollapse')}
className={classNames(
UNSAFE_className,
'AccordionCollapse',
variant === 'info' && 'AccordionCollapse--info',
)}
eventKey={eventKey}
{...props}
>
<div className="AccordionCollapse__container">
<div
className={classNames(
UNSAFE_className,
'AccordionCollapse__container',
variant === 'info' && 'AccordionCollapse--noTopPadding',
)}
>
{children}
</div>
</RBAccordionCollapse>
);

AccordionCollapse.defaultProps = {
variant: undefined,
UNSAFE_className: undefined,
};

Expand Down
5 changes: 5 additions & 0 deletions src/Accordion/AccordionItem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@
&--borderless {
border: none;
}

&--info {
background-color: var(--ux-blue-100);
color: var(--ux-blue-800);
}
}
4 changes: 4 additions & 0 deletions src/Accordion/AccordionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ type AccordionItemProps = {
UNSAFE_className?: string;
children: React.ReactNode;
eventKey: string;
variant?: string;
};

const AccordionItem = ({
variant,
as,
borderless,
children,
Expand All @@ -33,6 +35,7 @@ const AccordionItem = ({
className={classNames(
UNSAFE_className,
'AccordionItem',
variant === 'info' && 'AccordionItem--info',
borderless && 'AccordionItem--borderless',
)}
eventKey={eventKey}
Expand All @@ -42,6 +45,7 @@ const AccordionItem = ({
);

AccordionItem.defaultProps = {
variant: undefined,
as: undefined,
borderless: undefined,
UNSAFE_className: undefined,
Expand Down
18 changes: 10 additions & 8 deletions src/Select/Option.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ import './Option.scss';
const Option = forwardRef(({ indeterminate, ...props }, ref) => (
<components.Option {...props}>
<div className="Option">
<CheckboxButton
checked={props.isSelected}
className="Checkbox"
id={props.label}
indeterminate={indeterminate}
ref={ref}
onChange={() => null}
/>
<div className="CheckboxContainer">
<CheckboxButton
checked={props.isSelected}
className="Checkbox"
id={props.label}
indeterminate={indeterminate}
ref={ref}
onChange={() => null}
/>
</div>
<div className="TitleDescriptionContainer">
<label
className={classNames({
Expand Down
4 changes: 2 additions & 2 deletions src/Select/Option.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.Option {
display: flex;
align-items: center;


.Checkbox {
margin-top: var(--synth-spacing-1);
margin-right: var(--synth-spacing-3);
}

Expand Down

0 comments on commit 5cd7930

Please sign in to comment.