Move utilities css from global to local

This commit is contained in:
Luke committed 2024-05-25 19:53:11 +01:00
1 parent 36f15c381e
commit 58b3bf4959
4 files changed
+108 -106

No files matched your search

-91
View File
@@ -414,95 +414,4 @@ html[data-theme='dark'] {
border: 0;
border-radius: var(--ifm-global-radius);
color: #fff
}
.hidden {
display: none;
}
.font-normal {
font-weight: normal;
}
.button {
width: 150px;
outline: 3px solid var(--ifm-tabs-color-active);
outline-offset: -3px;
border: 0;
border-radius: var(--ifm-global-radius);
background-color: transparent;
text-align: center;
font-size: 18px;
font-weight: normal;
transition: background-color 0.5s ease, color 0.5s ease;
padding-top: 10px;
padding-bottom: 10px;
color: var(--ifm-tabs-color-active);
}
.button:hover {
background-color: var(--ifm-color-primary);
color: #fff;
}
.button-secondary {
outline: 3px solid var(--ifm-color-secondary);
}
.button-secondary:hover {
background-color: var(--ifm-color-secondary);
}
.form-input {
border-radius: var(--ifm-global-radius);
outline: 1px solid var(--ifm-color-secondary);
outline-offset: -1px;
padding: 10px;
min-width: 50%;
font-size: 16px;
}
.no-outline {
outline: none;
}
@media screen and (max-width: 768px) {
.form-input {
min-width: 100%;
}
}
/* 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;
}
.switch::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: none;
}
+13 -13
View File
@@ -169,7 +169,7 @@ const ConfigEditorPage: React.FC = () => {
// Handle all the dropdowns
case 'remote.auth-type':
return (
<select key={name} className='form-input' id={name} defaultValue={value} onChange={handleChange}>
<select key={name} className={styles.formInput} id={name} defaultValue={value} onChange={handleChange}>
<option value='offline'>offline</option>
<option value='online'>online</option>
<option value='floodgate'>floodgate</option>
@@ -177,7 +177,7 @@ const ConfigEditorPage: React.FC = () => {
);
case 'show-cooldown':
return (
<select key={name} className='form-input' id={name} defaultValue={value} onChange={handleChange}>
<select key={name} className={styles.formInput} id={name} defaultValue={value} onChange={handleChange}>
<option value='title'>title</option>
<option value='actionbar'>actionbar</option>
<option value='false'>false</option>
@@ -185,16 +185,16 @@ const ConfigEditorPage: React.FC = () => {
);
case 'emote-offhand-workaround':
return (
<select key={name} className='form-input' id={name} defaultValue={value} onChange={handleChange}>
<select key={name} className={styles.formInput} id={name} defaultValue={value} onChange={handleChange}>
<option value='disabled'>disabled</option>
<option value='no-emotes'>no-emotes</option>
<option value='emotes-and-offhand'>emotes-and-offhand</option>
</select>
);
case 'config-version':
return <input key={name} className='form-input' type='text' disabled defaultValue={value.replace(/"/g, '')} />;
return <input key={name} className={styles.formInput} type='text' disabled defaultValue={value.replace(/"/g, '')} />;
case 'metrics.uuid':
return <input key={name} className='form-input' id={name} type='text' disabled defaultValue={value === 'generateduuid' ? crypto.randomUUID() : value} />;
return <input key={name} className={styles.formInput} id={name} type='text' disabled defaultValue={value === 'generateduuid' ? crypto.randomUUID() : value} />;
default:
// Handle all the other inputs
@@ -202,16 +202,16 @@ const ConfigEditorPage: React.FC = () => {
// Boolean
return (
<div key={name}>
<input className='checkbox' type='checkbox' id={name} defaultChecked={value.toLowerCase() === 'true'} onChange={handleChange} />
<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)) {
// Number
return <input key={name} className='form-input' type='number' defaultValue={value} id={name} onChange={handleChange} />;
return <input key={name} className={styles.formInput} type='number' defaultValue={value} id={name} onChange={handleChange} />;
} else {
// String
return <input key={name} className='form-input' type='text' defaultValue={value.replace(/"/g, '')} id={name} onChange={handleChange} />;
return <input key={name} className={styles.formInput} type='text' defaultValue={value.replace(/"/g, '')} id={name} onChange={handleChange} />;
}
}
}
@@ -235,18 +235,18 @@ const ConfigEditorPage: React.FC = () => {
const NoConfigSection = () => (
<>
<h1><Translate id='pages.configeditor.noconfigselected.heading'>No config selected.</Translate></h1>
<h3 className='font-normal'><Translate id='pages.configeditor.noconfigselected.subheading'>Upload a file or get started with the default config!</Translate></h3>
<h3 className={styles.fontNormal}><Translate id='pages.configeditor.noconfigselected.subheading'>Upload a file or get started with the default config!</Translate></h3>
<div className={styles.buttonsContainer}>
<button className='button' onClick={loadDefault}>
<button className={styles.button} onClick={loadDefault}>
<Translate id='pages.configeditor.button.defaultconfig'>Default</Translate>
</button>
<button className='button' onClick={() => uploadRef.current.click()}>
<button className={styles.button} onClick={() => uploadRef.current.click()}>
<input
ref={uploadRef}
type='file'
className='hidden'
className={styles.hidden}
accept='.yml'
onChange={handleUpload}
/>
@@ -259,7 +259,7 @@ const ConfigEditorPage: React.FC = () => {
const EditorView = () => (
<>
<div className={styles.buttonsContainer} style={{ marginBottom: '30px' }}>
<button className='button' onClick={handleExport}>
<button className={styles.button} onClick={handleExport}>
<Translate id='pages.configeditor.button.export'>Export</Translate>
</button>
</div>
+2 -1
View File
@@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from 'react';
import styles from './utilities.module.css';
import { Grid } from '@site/src/components/Grid';
import CodeBlock from '@theme/CodeBlock';
import clsx from 'clsx';
const DumpViewerPage: React.FC = () => {
const [dumpId, setDumpId] = useState('');
@@ -89,7 +90,7 @@ const DumpViewerPage: React.FC = () => {
{Object.keys(data).length === 0 ? (
<>
<h2><Translate id='pages.dumpviewer.enterdumpid'>Enter Dump ID or URL below and click load.</Translate></h2>
<input id='dump-url' className='form-input no-outline' value={dumpId} onChange={(e) => setDumpId(e.target.value)} placeholder='Dump ID/URL' />
<input id='dump-url' className={clsx(styles.formInput, styles.noOutline)} value={dumpId} onChange={(e) => setDumpId(e.target.value)} placeholder='Dump ID/URL' />
<button className={styles.loadButton} onClick={handleLoadClick}>
<Translate id='pages.dumpviewer.button.load'>Load</Translate>
</button>
+93 -1
View File
@@ -107,4 +107,96 @@
height: 10px;
width: 10px;
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;
}
.switch::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: none;
}
.hidden {
display: none;
}
.fontNormal {
font-weight: normal;
}
.button {
width: 150px;
outline: 3px solid var(--ifm-tabs-color-active);
outline-offset: -3px;
border: 0;
border-radius: var(--ifm-global-radius);
background-color: transparent;
text-align: center;
font-size: 18px;
font-weight: normal;
transition: background-color 0.5s ease, color 0.5s ease;
padding-top: 10px;
padding-bottom: 10px;
color: var(--ifm-tabs-color-active);
}
.button:hover {
background-color: var(--ifm-color-primary);
color: #fff;
}
.buttonSecondary {
outline: 3px solid var(--ifm-color-secondary);
}
.buttonSecondary:hover {
background-color: var(--ifm-color-secondary);
}
.formInput {
border-radius: var(--ifm-global-radius);
outline: 1px solid var(--ifm-color-secondary);
outline-offset: -1px;
padding: 10px;
min-width: 50%;
font-size: 16px;
}
.noOutline {
outline: none;
}
@media screen and (max-width: 768px) {
.formInput {
min-width: 100%;
}
}