1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-06 14:16:50 +02:00

Merge pull request #138 from Ryuno-Ki/137-layout-for-input-id

Link <label for> to <input id>. Fixes #137
This commit is contained in:
phuoc-ng
2020-06-10 07:55:30 +07:00
committed by GitHub
6 changed files with 14 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ const Details: React.FC<{}> = () => {
return (
<label
htmlFor="custom-checkbox-button"
style={{
alignItems: 'center',
cursor: 'pointer',
@@ -31,6 +32,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="custom-checkbox-button"
type="checkbox"
name="option"
value={value}

View File

@@ -24,6 +24,7 @@ const Details: React.FC<{}> = () => {
return (
<label
htmlFor="custom-radio-button"
style={{
alignItems: 'center',
cursor: 'pointer',
@@ -31,6 +32,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="custom-radio-button"
type="radio"
name="option"
value={value}

View File

@@ -45,6 +45,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="floating-label-input"
placeholder="Placeholder"
type="text"
style={{
@@ -54,6 +55,7 @@ const Details: React.FC<{}> = () => {
}}
/>
<label
htmlFor="floating-label-input"
style={{
left: '8px',
padding: '0 8px',

View File

@@ -26,6 +26,7 @@ const Details: React.FC<{}> = () => {
return (
<label
htmlFor="radio-button-group"
style={{
alignItems: 'center',
backgroundColor: value === selectedValue ? '#00449E' : 'transparent',
@@ -35,6 +36,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="radio-button-group"
type="radio"
name="option"
value={value}

View File

@@ -44,6 +44,7 @@ const Details: React.FC<{}> = () => {
}}
>
<label
htmlFor="radio-switch-first"
style={{
backgroundColor: isFirstChecked ? '#357EDD' : '',
borderRadius: '9999px',
@@ -53,6 +54,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="radio-switch-first"
type="radio"
style={{ display: 'none' }}
checked={isFirstChecked}
@@ -68,6 +70,7 @@ const Details: React.FC<{}> = () => {
/>
</label>
<label
htmlFor="radio-switch-second"
style={{
backgroundColor: isFirstChecked ? '' : '#357EDD',
borderRadius: '9999px',
@@ -77,6 +80,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="radio-switch-second"
type="radio"
style={{ display: 'none' }}
checked={!isFirstChecked}

View File

@@ -39,6 +39,7 @@ const Details: React.FC<{}> = () => {
}}
>
<label
htmlFor="checkbox-switch"
style={{
backgroundColor: checked ? '#357EDD' : 'rgba(0, 0, 0, 0.1)',
border: `1px solid ${checked ? '#357EDD' : 'rgba(0, 0, 0, 0.3)'}`,
@@ -50,6 +51,7 @@ const Details: React.FC<{}> = () => {
}}
>
<input
id="checkbox-switch"
type="checkbox"
style={{ display: 'none' }}
checked={checked}