feat: Added translucency effect to menus, dialogs and alerts. Can be turned off from Preferences > Appeareance (#2387) [skip e2e]

This commit is contained in:
Aman Harwara
2023-08-05 20:40:37 +05:30
committed by GitHub
parent 83b83cd96d
commit ec309d6fb5
29 changed files with 264 additions and 28 deletions

View File

@@ -14,6 +14,7 @@ import PreferencesSegment from '../PreferencesComponents/PreferencesSegment'
import { PremiumFeatureIconName } from '@/Components/Icon/PremiumFeatureIcon'
import EditorAppearance from './Appearance/EditorAppearance'
import { GetAllThemesUseCase } from '@standardnotes/ui-services'
import usePreference from '@/Hooks/usePreference'
type Props = {
application: WebApplication
@@ -33,6 +34,11 @@ const Appearance: FunctionComponent<Props> = ({ application }) => {
application.getPreference(PrefKey.UseSystemColorScheme, PrefDefaults[PrefKey.UseSystemColorScheme]),
)
const useTranslucentUI = usePreference(PrefKey.UseTranslucentUI)
const toggleTranslucentUI = () => {
application.setPreference(PrefKey.UseTranslucentUI, !useTranslucentUI).catch(console.error)
}
useEffect(() => {
const usecase = new GetAllThemesUseCase(application.items)
const { thirdParty, native } = usecase.execute({ excludeLayerable: true })
@@ -106,6 +112,14 @@ const Appearance: FunctionComponent<Props> = ({ application }) => {
<PreferencesSegment>
<Title>Themes</Title>
<div className="mt-2">
<div className="flex justify-between gap-2 md:items-center">
<div className="flex flex-col">
<Subtitle>Disable translucent UI</Subtitle>
<Text>Use opaque style for UI elements instead of translucency</Text>
</div>
<Switch onChange={toggleTranslucentUI} checked={!useTranslucentUI} />
</div>
<HorizontalSeparator classes="my-4" />
<div className="flex justify-between gap-2 md:items-center">
<div className="flex flex-col">
<Subtitle>Use system color scheme</Subtitle>

View File

@@ -9,7 +9,10 @@ import { FOCUSABLE_BUT_NOT_TABBABLE } from '@/Constants/Constants'
const PreferencesCanvas: FunctionComponent<PreferencesProps & { menu: PreferencesSessionController }> = (props) => (
<div className="flex min-h-0 flex-grow flex-col md:flex-row md:justify-between">
<PreferencesMenuView menu={props.menu} />
<div className="min-h-0 flex-grow overflow-auto bg-contrast" tabIndex={FOCUSABLE_BUT_NOT_TABBABLE}>
<div
className="min-h-0 flex-grow overflow-auto bg-contrast md:bg-[--popover-background-color]"
tabIndex={FOCUSABLE_BUT_NOT_TABBABLE}
>
<PaneSelector {...props} />
</div>
</div>

View File

@@ -24,7 +24,7 @@ const PreferencesMenuView: FunctionComponent<Props> = ({ menu }) => {
)
return (
<div className="border-b border-border bg-default px-5 py-2 md:border-0 md:bg-contrast md:px-0 md:py-0">
<div className="border-b border-border bg-default px-5 py-2 md:border-0 md:bg-[--popover-background-color] md:px-0 md:py-0">
<div className="hidden min-w-55 flex-col overflow-y-auto px-3 py-6 md:flex">
{menuItems.map((pref) => (
<PreferencesMenuItem