Add focus states

This commit is contained in:
Justin Edmund 2023-08-20 06:39:10 -07:00
parent c07fdcb25c
commit 608f89c788
2 changed files with 73 additions and 0 deletions

View file

@ -55,6 +55,11 @@
margin: $unit-fourth; margin: $unit-fourth;
transition: all 0.1s ease-out; transition: all 0.1s ease-out;
:global(.remove) {
display: none;
padding: 0 $unit-half;
}
&:hover { &:hover {
background: var(--null-bg-hover); background: var(--null-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
@ -63,18 +68,34 @@
cursor: pointer; cursor: pointer;
} }
&:focus {
outline: 2px solid blue;
:global(.remove) {
display: block;
}
}
&[data-element='fire'] { &[data-element='fire'] {
background: var(--fire-bg); background: var(--fire-bg);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--fire-shadow); 0 1px 0px var(--fire-shadow);
color: var(--fire-text); color: var(--fire-text);
:global(.remove) {
color: var(--fire-text);
}
&:hover { &:hover {
background: var(--fire-bg-hover); background: var(--fire-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--fire-shadow-hover); 0 1px 0px var(--fire-shadow-hover);
color: var(--fire-text-hover); color: var(--fire-text-hover);
} }
&:focus {
outline: 2px solid var(--fire-shadow-hover);
}
} }
&[data-element='water'] { &[data-element='water'] {
@ -83,12 +104,20 @@
0 1px 0px var(--water-shadow); 0 1px 0px var(--water-shadow);
color: var(--water-text); color: var(--water-text);
:global(.remove) {
color: var(--water-text);
}
&:hover { &:hover {
background: var(--water-bg-hover); background: var(--water-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--water-shadow-hover); 0 1px 0px var(--water-shadow-hover);
color: var(--water-text-hover); color: var(--water-text-hover);
} }
&:focus {
outline: 2px solid var(--water-shadow-hover);
}
} }
&[data-element='earth'] { &[data-element='earth'] {
@ -97,12 +126,20 @@
0 1px 0px var(--earth-shadow); 0 1px 0px var(--earth-shadow);
color: var(--earth-text); color: var(--earth-text);
:global(.remove) {
color: var(--earth-text);
}
&:hover { &:hover {
background: var(--earth-bg-hover); background: var(--earth-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--earth-shadow-hover); 0 1px 0px var(--earth-shadow-hover);
color: var(--earth-text-hover); color: var(--earth-text-hover);
} }
&:focus {
outline: 2px solid var(--earth-shadow-hover);
}
} }
&[data-element='wind'] { &[data-element='wind'] {
@ -111,11 +148,19 @@
0 1px 0px var(--wind-shadow); 0 1px 0px var(--wind-shadow);
color: var(--wind-text); color: var(--wind-text);
:global(.remove) {
color: var(--wind-text);
}
&:hover { &:hover {
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--wind-shadow-hover); 0 1px 0px var(--wind-shadow-hover);
color: var(--wind-text-hover); color: var(--wind-text-hover);
} }
&:focus {
outline: 2px solid var(--wind-shadow-hover);
}
} }
&[data-element='dark'] { &[data-element='dark'] {
@ -124,12 +169,20 @@
0 1px 0px var(--dark-shadow); 0 1px 0px var(--dark-shadow);
color: var(--dark-text); color: var(--dark-text);
:global(.remove) {
color: var(--dark-text);
}
&:hover { &:hover {
background: var(--dark-bg-hover); background: var(--dark-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--dark-shadow-hover); 0 1px 0px var(--dark-shadow-hover);
color: var(--dark-text-hover); color: var(--dark-text-hover);
} }
&:focus {
outline: 2px solid var(--dark-shadow-hover);
}
} }
&[data-element='light'] { &[data-element='light'] {
@ -138,12 +191,20 @@
0 1px 0px var(--light-shadow); 0 1px 0px var(--light-shadow);
color: var(--light-text); color: var(--light-text);
:global(.remove) {
color: var(--light-text);
}
&:hover { &:hover {
background: var(--light-bg-hover); background: var(--light-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--light-shadow-hover); 0 1px 0px var(--light-shadow-hover);
color: var(--light-text-hover); color: var(--light-text-hover);
} }
&:focus {
outline: 2px solid var(--light-shadow-hover);
}
} }
} }
} }

View file

@ -117,6 +117,17 @@ export const FilterMention = Node.create<MentionOptions>({
}, },
renderHTML({ node, HTMLAttributes }) { renderHTML({ node, HTMLAttributes }) {
const removeButton = [
'span',
{
class: 'remove',
onclick: () => {
// Add functionality for the button click here
},
},
'\u00D7', // Unicode for the multiplication symbol
]
return [ return [
'div', 'div',
mergeAttributes( mergeAttributes(
@ -130,6 +141,7 @@ export const FilterMention = Node.create<MentionOptions>({
options: this.options, options: this.options,
node, node,
}), }),
removeButton,
] ]
}, },