Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix switch display on config editor page
Browse files Browse the repository at this point in the history
lukeeey committed Dec 17, 2024
1 parent d94cc09 commit 1981989
Showing 3 changed files with 11,821 additions and 18,150 deletions.
1 change: 0 additions & 1 deletion src/pages/utilities/config-editor.tsx
Original file line number Diff line number Diff line change
@@ -259,7 +259,6 @@ const ConfigEditorPage: React.FC = () => {
<div key={name}>
<input className={styles.checkbox} type='checkbox' id={name}
defaultChecked={value.toLowerCase() === 'true'} onChange={handleChange}/>
<label htmlFor={name} className='switch'></label>
</div>
);
} else if (!isNaN(value)) {
77 changes: 42 additions & 35 deletions src/pages/utilities/utilities.module.scss
Original file line number Diff line number Diff line change
@@ -109,41 +109,6 @@
border-radius: 50%;
}

/* https://codepen.io/JAGATHISH1123/pen/PvayMB */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 20px;
background-color: var(--switch-background-color);
border-radius: 20px;
transition: all 0.3s;

&::after {
content: '';
position: absolute;
width: 18px;
height: 18px;
border-radius: 50%;
background-color: white;
top: 1px;
left: 1px;
transition: all 0.3s;
}
}

.checkbox:checked+.switch::after {
left: 20px;
}

.checkbox:checked+.switch {
background-color: var(--ifm-color-secondary);
}

.checkbox {
display: inline-block;
}

.hidden {
display: none;
}
@@ -199,3 +164,45 @@
min-width: 100%;
}
}


:root {
--ifm-color-primary: #25c2a0;
}

.checkbox {
appearance: none;
position: relative;
display: inline-block;
box-sizing: content-box;
width: 4.5em;
height: 1.8em;
padding: 0.2em;
border: none;
cursor: pointer;
border-radius: 1.5em;
overflow: hidden;
background-color: #707070;
transition: background ease 0.3s;

&:before {
content: "";
display: block;
position: absolute;
z-index: 2;
width: 1.8em;
height: 1.8em;
background: #fff;
color: #fff;
border-radius: 1.5em;
transition: transform cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
}

&:checked {
background-color: var(--ifm-color-secondary);
}

&:checked:before {
transform: translateX(2.5em);
}
}
Loading

0 comments on commit 1981989

Please sign in to comment.