Waited wayy too long for Firefox to support :has

This commit is contained in:
Lim Chee Aun 2023-10-24 09:58:41 +08:00
parent 61756fac1d
commit 7555bda8e9
2 changed files with 22 additions and 20 deletions

View file

@ -85,7 +85,7 @@
transform: scale(0.975); transform: scale(0.975);
transition: all 0.2s ease-out; transition: all 0.2s ease-out;
} }
#shortcuts-settings-container .shortcuts-view-mode label:has(input:checked) { #shortcuts-settings-container .shortcuts-view-mode label.checked {
box-shadow: inset 0 0 0 3px var(--link-color); box-shadow: inset 0 0 0 3px var(--link-color);
} }
#shortcuts-settings-container #shortcuts-settings-container

View file

@ -271,17 +271,18 @@ function ShortcutsSettings({ onClose }) {
label: 'Multi-column', label: 'Multi-column',
imgURL: multiColumnUrl, imgURL: multiColumnUrl,
}, },
].map(({ value, label, imgURL }) => ( ].map(({ value, label, imgURL }) => {
<label> const checked =
snapStates.settings.shortcutsViewMode === value ||
(value === 'float-button' &&
!snapStates.settings.shortcutsViewMode);
return (
<label key={value} class={checked ? 'checked' : ''}>
<input <input
type="radio" type="radio"
name="shortcuts-view-mode" name="shortcuts-view-mode"
value={value} value={value}
checked={ checked={checked}
snapStates.settings.shortcutsViewMode === value ||
(value === 'float-button' &&
!snapStates.settings.shortcutsViewMode)
}
onChange={(e) => { onChange={(e) => {
states.settings.shortcutsViewMode = e.target.value; states.settings.shortcutsViewMode = e.target.value;
}} }}
@ -289,7 +290,8 @@ function ShortcutsSettings({ onClose }) {
<img src={imgURL} alt="" width="80" height="58" />{' '} <img src={imgURL} alt="" width="80" height="58" />{' '}
<span>{label}</span> <span>{label}</span>
</label> </label>
))} );
})}
</div> </div>
{/* <select {/* <select
value={snapStates.settings.shortcutsViewMode || 'float-button'} value={snapStates.settings.shortcutsViewMode || 'float-button'}