styles: make class names BEM and extract sn-dropdown-item style
This commit is contained in:
@@ -52,10 +52,6 @@ export const NotesOptions = observer(
|
|||||||
const tagsButtonRef = useRef<HTMLButtonElement>();
|
const tagsButtonRef = useRef<HTMLButtonElement>();
|
||||||
|
|
||||||
const iconClass = 'color-neutral mr-2';
|
const iconClass = 'color-neutral mr-2';
|
||||||
const buttonClass =
|
|
||||||
'flex items-center border-0 focus:inner-ring-info ' +
|
|
||||||
'cursor-pointer hover:bg-contrast color-text bg-transparent px-3 ' +
|
|
||||||
'text-left';
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (onSubmenuChange) {
|
if (onSubmenuChange) {
|
||||||
@@ -144,7 +140,7 @@ export const NotesOptions = observer(
|
|||||||
}}
|
}}
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
ref={tagsButtonRef}
|
ref={tagsButtonRef}
|
||||||
className={`${buttonClass} py-1.5 justify-between`}
|
className="sn-dropdown-item justify-between"
|
||||||
>
|
>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Icon type="hashtag" className={iconClass} />
|
<Icon type="hashtag" className={iconClass} />
|
||||||
@@ -169,7 +165,7 @@ export const NotesOptions = observer(
|
|||||||
{appState.tags.tags.map((tag) => (
|
{appState.tags.tags.map((tag) => (
|
||||||
<button
|
<button
|
||||||
key={tag.title}
|
key={tag.title}
|
||||||
className={`${buttonClass} py-2`}
|
className="sn-dropdown-item sn-dropdown-item--no-icon"
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
appState.notes.isTagInSelectedNotes(tag)
|
appState.notes.isTagInSelectedNotes(tag)
|
||||||
@@ -194,7 +190,7 @@ export const NotesOptions = observer(
|
|||||||
{unpinned && (
|
{unpinned && (
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
appState.notes.setPinSelectedNotes(true);
|
appState.notes.setPinSelectedNotes(true);
|
||||||
}}
|
}}
|
||||||
@@ -206,7 +202,7 @@ export const NotesOptions = observer(
|
|||||||
{pinned && (
|
{pinned && (
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
appState.notes.setPinSelectedNotes(false);
|
appState.notes.setPinSelectedNotes(false);
|
||||||
}}
|
}}
|
||||||
@@ -218,7 +214,7 @@ export const NotesOptions = observer(
|
|||||||
{unarchived && (
|
{unarchived && (
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
appState.notes.setArchiveSelectedNotes(true);
|
appState.notes.setArchiveSelectedNotes(true);
|
||||||
}}
|
}}
|
||||||
@@ -230,7 +226,7 @@ export const NotesOptions = observer(
|
|||||||
{archived && (
|
{archived && (
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
appState.notes.setArchiveSelectedNotes(false);
|
appState.notes.setArchiveSelectedNotes(false);
|
||||||
}}
|
}}
|
||||||
@@ -242,7 +238,7 @@ export const NotesOptions = observer(
|
|||||||
{notTrashed && (
|
{notTrashed && (
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await appState.notes.setTrashSelectedNotes(true);
|
await appState.notes.setTrashSelectedNotes(true);
|
||||||
}}
|
}}
|
||||||
@@ -255,7 +251,7 @@ export const NotesOptions = observer(
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await appState.notes.setTrashSelectedNotes(false);
|
await appState.notes.setTrashSelectedNotes(false);
|
||||||
}}
|
}}
|
||||||
@@ -265,7 +261,7 @@ export const NotesOptions = observer(
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await appState.notes.deleteNotesPermanently();
|
await appState.notes.deleteNotesPermanently();
|
||||||
}}
|
}}
|
||||||
@@ -275,7 +271,7 @@ export const NotesOptions = observer(
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
className={`${buttonClass} py-1.5`}
|
className="sn-dropdown-item"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await appState.notes.emptyTrash();
|
await appState.notes.emptyTrash();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const SearchOptions = observer(({ appState }: Props) => {
|
|||||||
style={{
|
style={{
|
||||||
top: optionsPanelTop,
|
top: optionsPanelTop,
|
||||||
}}
|
}}
|
||||||
className="sn-dropdown sn-dropdown-anchor-right absolute grid gap-2 py-2"
|
className="sn-dropdown sn-dropdown--anchor-right absolute grid gap-2 py-2"
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
className="h-10"
|
className="h-10"
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export const Switch: FunctionalComponent<SwitchProps> = (
|
|||||||
<span
|
<span
|
||||||
aria-hidden
|
aria-hidden
|
||||||
className={`sn-switch-handle ${
|
className={`sn-switch-handle ${
|
||||||
checked ? 'sn-switch-handle-right' : ''
|
checked ? 'sn-switch-handle--right' : ''
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
</CustomCheckboxContainer>
|
</CustomCheckboxContainer>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const Tag: FunctionalComponent<TagProps> = ({ title, className }) => (
|
|||||||
<span
|
<span
|
||||||
className={`bg-contrast rounded text-xs color-text p-1 flex items-center ${className ?? ''}`}
|
className={`bg-contrast rounded text-xs color-text p-1 flex items-center ${className ?? ''}`}
|
||||||
>
|
>
|
||||||
<Icon type="hashtag" className="small color-neutral mr-1" />
|
<Icon type="hashtag" className="sn-icon--small color-neutral mr-1" />
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -235,11 +235,11 @@
|
|||||||
@extend .h-5;
|
@extend .h-5;
|
||||||
@extend .w-5;
|
@extend .w-5;
|
||||||
@extend .fill-current;
|
@extend .fill-current;
|
||||||
}
|
|
||||||
|
|
||||||
.sn-icon.small {
|
&.sn-icon--small {
|
||||||
@extend .h-3\.5 ;
|
@extend .h-3\.5 ;
|
||||||
@extend .w-3\.5 ;
|
@extend .w-3\.5 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sn-dropdown {
|
.sn-dropdown {
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
|
|
||||||
z-index: $z-index-dropdown-menu;
|
z-index: $z-index-dropdown-menu;
|
||||||
|
|
||||||
&.sn-dropdown-anchor-right {
|
&.sn-dropdown--anchor-right {
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(0px, -50%);
|
transform: translate(0px, -50%);
|
||||||
|
|
||||||
&.sn-switch-handle-right {
|
&.sn-switch-handle--right {
|
||||||
transform: translate(
|
transform: translate(
|
||||||
calc(2rem - 1.125rem),
|
calc(2rem - 1.125rem),
|
||||||
-50%
|
-50%
|
||||||
@@ -308,3 +308,21 @@
|
|||||||
.sn-component .sk-app-bar .sk-app-bar-item {
|
.sn-component .sk-app-bar .sk-app-bar-item {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sn-dropdown-item {
|
||||||
|
@extend .flex;
|
||||||
|
@extend .items-center;
|
||||||
|
@extend .border-0;
|
||||||
|
@extend .focus\:inner-ring-info;
|
||||||
|
@extend .cursor-pointer;
|
||||||
|
@extend .hover\:bg-contrast;
|
||||||
|
@extend .color-text;
|
||||||
|
@extend .bg-transparent;
|
||||||
|
@extend .px-3;
|
||||||
|
@extend .py-1\.5;
|
||||||
|
@extend .text-left;
|
||||||
|
|
||||||
|
&.sn-dropdown-item--no-icon {
|
||||||
|
@extend .py-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user