Skip to content

Commit

Permalink
(HDS-2142) Fix checkbox layout issue, add story for external label, u…
Browse files Browse the repository at this point in the history
…pdate reference images
  • Loading branch information
mrTuomoK committed Feb 23, 2024
1 parent d356f3e commit 6570b7f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Changes that are not related to specific components

- Removed old & deprecated individual `lodash` dependencies and replaced with the full package and importing the needed functions only.
- [HeaderActionBarItemWithDropdown] Removed useless `@layer` css style which caused Jest/jsdom tests output errors.
- [Checkbox] Layout issue when using external label with htmlLabelFor-attribute

### Core

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/checkbox/checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
}

.hds-checkbox .hds-checkbox__label--hidden {
padding-left: 0;
padding-left: var(--size);
}

/* ERROR */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions packages/react/src/components/checkbox/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,22 @@ export const GroupWithParent = () => {

GroupWithParent.storyName = 'Group with a parent';

export const WithExternalLabel = () => {
const customStyle = {
'--background-unselected': 'teal',
'margin-right': 'var(--spacing-2-xs)',
} as React.CSSProperties;

return (
<div style={{ display: 'flex', alignItems: 'center' }}>
<Checkbox id="withExternalLabel" style={customStyle} />
<label htmlFor="withExternalLabel">
<h3>External label</h3>
</label>
</div>
);
};

export const Playground = (args) => {
const [checkedItems, setCheckedItems] = useState({});
const options = ['Option 1', 'Option 2', 'Option 3'];
Expand Down

0 comments on commit 6570b7f

Please sign in to comment.