-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: “BogdanDanilescu” <bogdan.danilescu@nearform.com> Co-authored-by: Andrea Pregnolato <andrea.pregnolato@nearform.com>
- Loading branch information
1 parent
151aeed
commit 1067f5c
Showing
30 changed files
with
1,907 additions
and
152 deletions.
There are no files selected for viewing
473 changes: 472 additions & 1 deletion
473
apps/docs/content/3-components/2-library/32-radio-button.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export const standardProps = { | ||
fieldId: 'uniqueId', | ||
title: { | ||
value: 'Where do you live?', | ||
asHeading: { | ||
size: 'md', | ||
as: 'h2', | ||
}, | ||
}, | ||
items: [ | ||
{ | ||
label: 'England', | ||
value: 'england', | ||
}, | ||
{ | ||
label: 'Scotland', | ||
value: 'scotland', | ||
}, | ||
{ | ||
label: 'Ireland', | ||
value: 'ireland', | ||
}, | ||
], | ||
}; | ||
|
||
export const inlineProps = { | ||
...standardProps, | ||
inline: true, | ||
}; | ||
|
||
export const hintsProps = { | ||
fieldId: 'uniqueId', | ||
title: { | ||
value: 'Have you changed your name?', | ||
hint: 'This includes changing your last name or spelling your name differently.', | ||
asHeading: { | ||
size: 'md', | ||
as: 'h2', | ||
}, | ||
}, | ||
items: [ | ||
{ | ||
label: 'Yes', | ||
value: 'yes', | ||
hint: 'Yes, I have changed my name', | ||
}, | ||
{ | ||
label: 'No', | ||
value: 'no', | ||
hint: "No, I didn't change my name", | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% macro getRadioSize(size) %} | ||
{% if size == 'lg' %} | ||
gi-radio-large | ||
{% elif size == 'sm' %} | ||
gi-radio-small | ||
{% else %} | ||
gi-radio-medium | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro getRadioWidth(size) %} | ||
{% if size == 'lg' %} | ||
gi-w-11 | ||
{% elif size == 'sm' %} | ||
gi-w-6 | ||
{% else %} | ||
gi-w-8 | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{% from 'radio/helpers.html' import getRadioSize, getRadioWidth %} | ||
{% from 'hint-text/hint-text.html' import govieHintText %} | ||
{% from 'text-input/text-input.html' import govieTextInput %} | ||
|
||
{% macro govieRadio(props) %} | ||
{% set hasConditionalInput = true if props.conditionalInput %} | ||
|
||
<div class="gi-flex gi-flex-col"> | ||
<div class="gi-gap-4 gi-flex gi-items-center"> | ||
<input | ||
name="{{ props.name }}" | ||
data-has-conditional-input="{{ hasConditionalInput }}" | ||
data-primary="true" | ||
data-element="{{ props.dataElement }}" | ||
id="{{ props.radioId }}" | ||
value="{{ props.value }}" | ||
class="{{ getRadioSize(props.size) | trim }} gi-radio-base" | ||
type="radio" | ||
/> | ||
<label | ||
for="{{ props.radioId }}" | ||
class="gi-cursor-pointer xs:gi-text-sm md:gi-text-md lg:gi-text-lg" | ||
> | ||
{{ props.label }} | ||
</label> | ||
</div> | ||
{% if props.hint or props.conditionalInput %} | ||
<div class="gi-flex gi-gap-4"> | ||
<div | ||
data-conditional-divider="{{ props.radioId }}" | ||
class="{{ getRadioWidth(props.size) | trim }} gi-invisible" | ||
> | ||
<div | ||
class="{{ getRadioWidth(props.size) | trim }} gi-h-full gi-flex gi-justify-center gi-mt-1.5" | ||
> | ||
<div class="gi-h-full gi-w-1 gi-bg-gray-300"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div> | ||
{{ | ||
govieHintText({ | ||
"content": props.hint, | ||
"classNames": "!gi-mb-0" | ||
}) | ||
}} | ||
</div> | ||
{% if props.conditionalInput %} | ||
<div | ||
data-conditional-container="{{ props.radioId }}" | ||
class="gi-hidden" | ||
> | ||
{{ govieTextInput(props.conditionalInput) }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% endmacro %} |
Oops, something went wrong.