Skip to content

Commit

Permalink
add wrappedElement option on PixLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
xav-car committed May 2, 2024
1 parent 992cf72 commit bc2d127
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions addon/components/pix-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default class PixLabel extends Component {
const classes = ['pix-label'];

if (this.args.screenReaderOnly) classes.push('screen-reader-only');
if (this.args.wrappedElement) classes.push('pix-label--wrapped-element');
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
if (this.args.isDisabled) classes.push('pix-label--disabled');

Expand Down
1 change: 1 addition & 0 deletions addon/components/pix-radio-button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@screenReaderOnly={{@screenReaderOnly}}
@isDisabled={{@isDisabled}}
@inlineLabel={{true}}
@wrappedElement={{true}}
>
<input
type="radio"
Expand Down
6 changes: 6 additions & 0 deletions addon/styles/_pix-label.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
color: var(--pix-neutral-900);
font-weight: var(--pix-font-medium);

&--wrapped-element {
display: flex;
gap: var(--pix-spacing-3x);
align-items: center;
}

&--disabled {
color: var(--pix-neutral-500);
}
Expand Down
6 changes: 0 additions & 6 deletions addon/styles/_pix-radio-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
margin-top: var(--pix-spacing-4x);
}

.pix-label {
display: flex;
gap: var(--pix-spacing-3x);
align-items: center;
}

&__input {
position: relative;
flex-shrink: 0;
Expand Down
9 changes: 9 additions & 0 deletions app/stories/pix-label.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ export default {
},
control: { type: 'boolean' },
},
wrappedElement: {
name: 'wrappedElement',
description: "Permet de définir si le label englobe l'input associé",
type: { name: 'boolean', required: false },
table: {
defaultValue: { summary: false },
},
control: { type: 'boolean' },
},
},
};

Expand Down

0 comments on commit bc2d127

Please sign in to comment.