Better tauri listeners and stuff

This commit is contained in:
Gregory Schier
2023-03-30 09:05:54 -07:00
parent d2e0717d91
commit bb41f0e4fe
23 changed files with 305 additions and 794 deletions

View File

@@ -1,10 +1,10 @@
import classnames from 'classnames';
import { motion } from 'framer-motion';
import { useMemo } from 'react';
import type { ReactNode } from 'react';
import { useMemo } from 'react';
import { Overlay } from '../Overlay';
import { IconButton } from './IconButton';
import { HStack, VStack } from './Stacks';
import { VStack } from './Stacks';
export interface DialogProps {
children: ReactNode;

View File

@@ -33,7 +33,6 @@ import {
} from '@codemirror/view';
import { tags as t } from '@lezer/highlight';
import { graphql, graphqlLanguageSupport } from 'cm6-graphql';
import { render } from 'react-dom';
import type { EditorProps } from './index';
import { text } from './text/extension';
import { twig } from './twig/extension';

View File

@@ -3,23 +3,28 @@ import type { DropdownItemSeparator, DropdownProps } from './Dropdown';
import { Dropdown } from './Dropdown';
import { Icon } from './Icon';
export type RadioDropdownItem =
export type RadioDropdownItem<T = string | null> =
| {
type?: 'default';
label: string;
shortLabel?: string;
value: string | null;
value: T;
}
| DropdownItemSeparator;
export interface RadioDropdownProps {
value: string | null;
onChange: (value: string | null) => void;
items: RadioDropdownItem[];
export interface RadioDropdownProps<T = string | null> {
value: T;
onChange: (value: T) => void;
items: RadioDropdownItem<T>[];
children: DropdownProps['children'];
}
export function RadioDropdown({ value, items, onChange, children }: RadioDropdownProps) {
export function RadioDropdown<T = string | null>({
value,
items,
onChange,
children,
}: RadioDropdownProps<T>) {
const dropdownItems = useMemo(
() =>
items.map((item) => {