Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): fix css editor + fix dark mode #2409

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Copy, MoveLeft, MoveRight, Paintbrush2 } from 'lucide-svelte'
import { createEventDispatcher } from 'svelte'
import { fade } from 'svelte/transition'
import { addWhitespaceBeforeCapitals, copyToClipboard } from '../../../../utils'
import { addWhitespaceBeforeCapitals, copyToClipboard, sendUserToast } from '../../../../utils'
import { Button, ClearableInput } from '../../../common'
import Popover from '../../../Popover.svelte'
import type { ComponentCssProperty } from '../../types'
Expand All @@ -13,6 +13,7 @@
import Badge from '$lib/components/common/badge/Badge.svelte'
import Toggle from '$lib/components/Toggle.svelte'
import CssEval from './CssEval.svelte'
import parse from 'style-to-object'

export let name: string
export let value: ComponentCssProperty = {}
Expand All @@ -33,8 +34,16 @@
$: dispatch('change', value)

function toggleQuickMenu() {
isQuickMenuOpen = !isQuickMenuOpen
try {
if (value.style) {
parse(value.style)
isQuickMenuOpen = !isQuickMenuOpen
}
} catch {
sendUserToast('Invalid CSS: Rich editor cannot be open', true)
}
}

let dynamicClass: boolean = value.evalClass !== undefined
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
{prefix}
openByDefault={true}
wrapperClasses="!px-0 !pt-0"
toggleClasses="border-b border-gray-300 !rounded-b-none !py-0
{isOpen[prefix] ? '!bg-gray-100 hover:!bg-gray-200' : ''}"
toggleClasses="border-b !rounded-b-none !py-0
{isOpen[prefix] ? '!bg-surface-secondary hover:!bg-surface-hover' : ''}"
>
<svelte:fragment slot="title">
<span class="font-semibold text-tertiary capitalize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Menu
let:close
noMinW
wrapperClasses="h-full bg-surface rounded-r-md border-y border-r border-gray-300 pr-0.5"
wrapperClasses="h-full bg-surface rounded-r-md border-y border-r pr-0.5"
popupClasses="!mt-0"
>
<button
Expand Down