mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 11:17:01 +02:00
More work on the layout
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
import { Button } from './components/Button';
|
||||||
|
import { Divider } from './components/Divider';
|
||||||
import { Grid } from './components/Grid';
|
import { Grid } from './components/Grid';
|
||||||
import { RequestPane } from './components/RequestPane';
|
import { RequestPane } from './components/RequestPane';
|
||||||
import { ResponsePane } from './components/ResponsePane';
|
import { ResponsePane } from './components/ResponsePane';
|
||||||
@@ -34,10 +36,34 @@ function App() {
|
|||||||
<div className="grid grid-cols-[auto_1fr] h-full text-gray-900">
|
<div className="grid grid-cols-[auto_1fr] h-full text-gray-900">
|
||||||
<Sidebar requests={requests ?? []} workspaceId={workspaceId} activeRequestId={request?.id} />
|
<Sidebar requests={requests ?? []} workspaceId={workspaceId} activeRequestId={request?.id} />
|
||||||
{request && (
|
{request && (
|
||||||
<Grid cols={isH ? 2 : 1} rows={isH ? 1 : 2} gap={2}>
|
<div className="p-2 h-full">
|
||||||
<RequestPane request={request} className={classnames(isH ? 'pr-0' : 'pb-0')} />
|
<div className="grid grid-rows-[auto_1fr] rounded-md h-full overflow-hidden">
|
||||||
<ResponsePane requestId={request.id} className={classnames(isH ? 'pl-0' : 'pt-0')} />
|
<HStack
|
||||||
</Grid>
|
data-tauri-drag-region
|
||||||
|
className="h-10 px-3 bg-gray-50"
|
||||||
|
justify="center"
|
||||||
|
items="center"
|
||||||
|
>
|
||||||
|
{request.name}
|
||||||
|
</HStack>
|
||||||
|
<div
|
||||||
|
className={classnames(
|
||||||
|
'py-2 px-1 bg-gray-25 grid overflow-auto',
|
||||||
|
isH ? 'grid-cols-[1fr_1fr]' : 'grid-rows-[minmax(0,auto)_minmax(0,100%)]',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<RequestPane
|
||||||
|
fullHeight={isH}
|
||||||
|
request={request}
|
||||||
|
className={classnames(
|
||||||
|
'border-gray-100/50',
|
||||||
|
isH ? 'pr-0 border-r' : 'pb-3 mb-1 border-b',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<ResponsePane requestId={request.id} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
.cm-wrapper {
|
.cm-wrapper {
|
||||||
height: 100%;
|
@apply h-full;
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cm-wrapper .cm-editor {
|
&.cm-full-height {
|
||||||
@apply inset-0;
|
@apply relative;
|
||||||
position: absolute !important;
|
|
||||||
font-size: 0.85em;
|
.cm-editor {
|
||||||
|
@apply inset-0;
|
||||||
|
position: absolute !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cm-editor {
|
.cm-editor {
|
||||||
@apply w-full block;
|
@apply w-full block text-[0.85rem];
|
||||||
|
|
||||||
&.cm-focused {
|
&.cm-focused {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { baseExtensions, getLanguageExtension, multiLineExtensions } from './ext
|
|||||||
import { singleLineExt } from './singleLine';
|
import { singleLineExt } from './singleLine';
|
||||||
|
|
||||||
export interface EditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
export interface EditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
||||||
|
height?: 'auto' | 'full';
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
autoFocus?: boolean;
|
autoFocus?: boolean;
|
||||||
valueKey?: string | number;
|
valueKey?: string | number;
|
||||||
@@ -23,6 +24,7 @@ export interface EditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Editor({
|
export default function Editor({
|
||||||
|
height,
|
||||||
contentType,
|
contentType,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
placeholder,
|
placeholder,
|
||||||
@@ -95,6 +97,7 @@ export default function Editor({
|
|||||||
className={classnames(
|
className={classnames(
|
||||||
className,
|
className,
|
||||||
'cm-wrapper text-base',
|
'cm-wrapper text-base',
|
||||||
|
height === 'auto' ? 'cm-auto-height' : 'cm-full-height',
|
||||||
singleLine ? 'cm-singleline' : 'cm-multiline',
|
singleLine ? 'cm-singleline' : 'cm-multiline',
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import classnames from 'classnames';
|
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
export interface LayoutPaneProps {
|
export interface LayoutPaneProps {
|
||||||
@@ -7,9 +6,10 @@ export interface LayoutPaneProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function LayoutPane({ className, children }: LayoutPaneProps) {
|
export function LayoutPane({ className, children }: LayoutPaneProps) {
|
||||||
return (
|
return <div className={className}>{children}</div>;
|
||||||
<div className={classnames(className, 'w-full h-full p-2')} data-tauri-drag-region>
|
// return (
|
||||||
<div className={classnames('w-full h-full bg-gray-50/50 rounded-lg')}>{children}</div>
|
// <div className={classnames(className, 'w-full h-full p-2')} data-tauri-drag-region>
|
||||||
</div>
|
// <div className={classnames('w-full h-full bg-gray-50/50 rounded-lg')}>{children}</div>
|
||||||
);
|
// </div>
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +1,64 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { useDeleteRequest, useRequestUpdate, useSendRequest } from '../hooks/useRequest';
|
import { useRequestUpdate, useSendRequest } from '../hooks/useRequest';
|
||||||
import type { HttpRequest } from '../lib/models';
|
import type { HttpRequest } from '../lib/models';
|
||||||
import { Button } from './Button';
|
import { Button } from './Button';
|
||||||
import { Divider } from './Divider';
|
import { Divider } from './Divider';
|
||||||
import Editor from './Editor/Editor';
|
import Editor from './Editor/Editor';
|
||||||
import type { LayoutPaneProps } from './LayoutPane';
|
|
||||||
import { LayoutPane } from './LayoutPane';
|
|
||||||
import { ScrollArea } from './ScrollArea';
|
import { ScrollArea } from './ScrollArea';
|
||||||
import { HStack } from './Stacks';
|
import { HStack } from './Stacks';
|
||||||
import { UrlBar } from './UrlBar';
|
import { UrlBar } from './UrlBar';
|
||||||
|
|
||||||
interface Props extends LayoutPaneProps {
|
interface Props {
|
||||||
request: HttpRequest;
|
request: HttpRequest;
|
||||||
|
fullHeight: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RequestPane({ request, ...props }: Props) {
|
export function RequestPane({ fullHeight, request, className }: Props) {
|
||||||
const updateRequest = useRequestUpdate(request ?? null);
|
const updateRequest = useRequestUpdate(request ?? null);
|
||||||
const sendRequest = useSendRequest(request ?? null);
|
const sendRequest = useSendRequest(request ?? null);
|
||||||
return (
|
return (
|
||||||
<LayoutPane {...props}>
|
<div className={classnames(className, 'grid grid-rows-[auto_auto_minmax(0,1fr)] grid-cols-1')}>
|
||||||
<div className="h-full grid grid-rows-[auto_auto_minmax(0,1fr)] grid-cols-1 pt-1 pb-2">
|
<div>
|
||||||
{/*<HStack as={WindowDragRegion} items="center" className="pl-3 pr-1.5">*/}
|
<UrlBar
|
||||||
{/* Test Request*/}
|
className="bg-transparent border-0 mb-1"
|
||||||
{/* <IconButton size="sm" icon="trash" onClick={() => deleteRequest.mutate()} />*/}
|
key={request.id}
|
||||||
{/*</HStack>*/}
|
method={request.method}
|
||||||
<div>
|
url={request.url}
|
||||||
<UrlBar
|
loading={sendRequest.isLoading}
|
||||||
className="bg-transparent border-0 mb-1"
|
onMethodChange={(method) => updateRequest.mutate({ method })}
|
||||||
key={request.id}
|
onUrlChange={(url) => updateRequest.mutate({ url })}
|
||||||
method={request.method}
|
sendRequest={sendRequest.mutate}
|
||||||
url={request.url}
|
/>
|
||||||
loading={sendRequest.isLoading}
|
<div className="mx-2">
|
||||||
onMethodChange={(method) => updateRequest.mutate({ method })}
|
<Divider />
|
||||||
onUrlChange={(url) => updateRequest.mutate({ url })}
|
|
||||||
sendRequest={sendRequest.mutate}
|
|
||||||
/>
|
|
||||||
<div className="mx-2">
|
|
||||||
<Divider />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/*<Divider className="mb-2" />*/}
|
|
||||||
<ScrollArea className="max-w-full pb-2 mx-2">
|
|
||||||
<HStack className="mt-2 hide-scrollbar" space={1}>
|
|
||||||
{['JSON', 'Params', 'Headers', 'Auth', 'Docs'].map((label, i) => (
|
|
||||||
<Button
|
|
||||||
key={label}
|
|
||||||
size="xs"
|
|
||||||
color={i === 0 && 'gray'}
|
|
||||||
className={i !== 0 && 'opacity-50 hover:opacity-60'}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</Button>
|
|
||||||
))}
|
|
||||||
</HStack>
|
|
||||||
</ScrollArea>
|
|
||||||
<div className="px-0">
|
|
||||||
<Editor
|
|
||||||
valueKey={request.id}
|
|
||||||
useTemplating
|
|
||||||
defaultValue={request.body ?? ''}
|
|
||||||
contentType="application/json"
|
|
||||||
onChange={(body) => updateRequest.mutate({ body })}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</LayoutPane>
|
{/*<Divider className="mb-2" />*/}
|
||||||
|
<ScrollArea className="max-w-full pb-2 mx-2">
|
||||||
|
<HStack className="mt-2 hide-scrollbar" space={1}>
|
||||||
|
{['JSON', 'Params', 'Headers', 'Auth', 'Docs'].map((label, i) => (
|
||||||
|
<Button
|
||||||
|
key={label}
|
||||||
|
size="xs"
|
||||||
|
color={i === 0 && 'gray'}
|
||||||
|
className={i !== 0 && 'opacity-50 hover:opacity-60'}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</HStack>
|
||||||
|
</ScrollArea>
|
||||||
|
<div className="px-0">
|
||||||
|
<Editor
|
||||||
|
height={fullHeight ? 'full' : 'auto'}
|
||||||
|
valueKey={request.id}
|
||||||
|
useTemplating
|
||||||
|
defaultValue={request.body ?? ''}
|
||||||
|
contentType="application/json"
|
||||||
|
onChange={(body) => updateRequest.mutate({ body })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { useDeleteAllResponses, useDeleteResponse, useResponses } from '../hooks/useResponses';
|
import { useDeleteAllResponses, useDeleteResponse, useResponses } from '../hooks/useResponses';
|
||||||
|
import { Button } from './Button';
|
||||||
import { Divider } from './Divider';
|
import { Divider } from './Divider';
|
||||||
import { Dropdown } from './Dropdown';
|
import { Dropdown } from './Dropdown';
|
||||||
import Editor from './Editor/Editor';
|
import Editor from './Editor/Editor';
|
||||||
import { Icon } from './Icon';
|
import { Icon } from './Icon';
|
||||||
import { IconButton } from './IconButton';
|
import { IconButton } from './IconButton';
|
||||||
import type { LayoutPaneProps } from './LayoutPane';
|
import { ScrollArea } from './ScrollArea';
|
||||||
import { LayoutPane } from './LayoutPane';
|
|
||||||
import { HStack } from './Stacks';
|
import { HStack } from './Stacks';
|
||||||
|
|
||||||
interface Props extends LayoutPaneProps {
|
interface Props {
|
||||||
requestId: string;
|
requestId: string;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ResponsePane({ requestId, className, ...props }: Props) {
|
export function ResponsePane({ requestId, className }: Props) {
|
||||||
const [activeResponseId, setActiveResponseId] = useState<string | null>(null);
|
const [activeResponseId, setActiveResponseId] = useState<string | null>(null);
|
||||||
const [viewMode, setViewMode] = useState<'pretty' | 'raw'>('pretty');
|
const [viewMode, setViewMode] = useState<'pretty' | 'raw'>('pretty');
|
||||||
const responses = useResponses(requestId);
|
const responses = useResponses(requestId);
|
||||||
@@ -44,81 +45,99 @@ export function ResponsePane({ requestId, className, ...props }: Props) {
|
|||||||
}, [response?.body, contentType]);
|
}, [response?.body, contentType]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutPane className={classnames(className)} {...props}>
|
<div
|
||||||
<div className="max-h-full h-full grid grid-rows-[auto_minmax(0,1fr)] grid-cols-1 py-1 px-2">
|
className={classnames(
|
||||||
{/*<HStack as={WindowDragRegion} items="center" className="pl-1.5 pr-1">*/}
|
className,
|
||||||
{/*</HStack>*/}
|
'max-h-full h-full grid grid-rows-[auto_auto_minmax(0,1fr)] grid-cols-1',
|
||||||
{response?.error && (
|
)}
|
||||||
<div className="text-white bg-red-500 px-2 py-1 rounded">{response.error}</div>
|
>
|
||||||
)}
|
{/*<HStack as={WindowDragRegion} items="center" className="pl-1.5 pr-1">*/}
|
||||||
{response && (
|
{/*</HStack>*/}
|
||||||
<>
|
{response?.error && (
|
||||||
<div className="mb-2">
|
<div className="text-white bg-red-500 px-2 py-1 rounded">{response.error}</div>
|
||||||
<HStack
|
)}
|
||||||
data-tauri-drag-region
|
{response && (
|
||||||
items="center"
|
<>
|
||||||
className="italic text-gray-500 text-sm w-full mb-1 flex-shrink-0"
|
<div>
|
||||||
>
|
<HStack
|
||||||
<div data-tauri-drag-region className="whitespace-nowrap">
|
items="center"
|
||||||
{response.status}
|
className="italic text-gray-500 text-sm w-full mb-1 flex-shrink-0 pl-2"
|
||||||
{response.statusReason && ` ${response.statusReason}`}
|
>
|
||||||
•
|
<div className="whitespace-nowrap">
|
||||||
{response.elapsed}ms •
|
{response.status}
|
||||||
{Math.round(response.body.length / 1000)} KB
|
{response.statusReason && ` ${response.statusReason}`}
|
||||||
</div>
|
•
|
||||||
|
{response.elapsed}ms •
|
||||||
|
{Math.round(response.body.length / 1000)} KB
|
||||||
|
</div>
|
||||||
|
|
||||||
<HStack items="center" className="ml-auto">
|
<HStack items="center" className="ml-auto">
|
||||||
{contentType.includes('html') && (
|
{contentType.includes('html') && (
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={viewMode === 'pretty' ? 'eye' : 'code'}
|
icon={viewMode === 'pretty' ? 'eye' : 'code'}
|
||||||
size="sm"
|
size="sm"
|
||||||
className="ml-1"
|
className="ml-1"
|
||||||
onClick={() => setViewMode((m) => (m === 'pretty' ? 'raw' : 'pretty'))}
|
onClick={() => setViewMode((m) => (m === 'pretty' ? 'raw' : 'pretty'))}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Dropdown
|
<Dropdown
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: 'Clear Response',
|
label: 'Clear Response',
|
||||||
onSelect: deleteResponse.mutate,
|
onSelect: deleteResponse.mutate,
|
||||||
disabled: responses.data.length === 0,
|
disabled: responses.data.length === 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Clear All Responses',
|
label: 'Clear All Responses',
|
||||||
onSelect: deleteAllResponses.mutate,
|
onSelect: deleteAllResponses.mutate,
|
||||||
disabled: responses.data.length === 0,
|
disabled: responses.data.length === 0,
|
||||||
},
|
},
|
||||||
'-----',
|
'-----',
|
||||||
...responses.data.slice(0, 10).map((r) => ({
|
...responses.data.slice(0, 10).map((r) => ({
|
||||||
label: r.status + ' - ' + r.elapsed + ' ms',
|
label: r.status + ' - ' + r.elapsed + ' ms',
|
||||||
leftSlot: response?.id === r.id ? <Icon icon="check" /> : <></>,
|
leftSlot: response?.id === r.id ? <Icon icon="check" /> : <></>,
|
||||||
onSelect: () => setActiveResponseId(r.id),
|
onSelect: () => setActiveResponseId(r.id),
|
||||||
})),
|
})),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<IconButton icon="gear" className="ml-auto" size="sm" />
|
<IconButton icon="gear" className="ml-auto" size="sm" />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</HStack>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
|
</HStack>
|
||||||
|
<div className="px-2">
|
||||||
<Divider />
|
<Divider />
|
||||||
</div>
|
</div>
|
||||||
{viewMode === 'pretty' && contentForIframe !== null ? (
|
</div>
|
||||||
<iframe
|
<ScrollArea className="max-w-full pb-2 mx-2">
|
||||||
title="Response preview"
|
<HStack className="mt-2 hide-scrollbar" space={1}>
|
||||||
srcDoc={contentForIframe}
|
{['Preview', 'Headers', 'Cookies', 'Timing'].map((label, i) => (
|
||||||
sandbox="allow-scripts allow-same-origin"
|
<Button
|
||||||
className="h-full w-full rounded-lg"
|
key={label}
|
||||||
/>
|
size="xs"
|
||||||
) : response?.body ? (
|
color={i === 0 && 'gray'}
|
||||||
<Editor
|
className={i !== 0 && 'opacity-50 hover:opacity-60'}
|
||||||
valueKey={`${contentType}:${response.body}`}
|
>
|
||||||
defaultValue={response?.body}
|
{label}
|
||||||
contentType={contentType}
|
</Button>
|
||||||
/>
|
))}
|
||||||
) : null}
|
</HStack>
|
||||||
</>
|
</ScrollArea>
|
||||||
)}
|
{viewMode === 'pretty' && contentForIframe !== null ? (
|
||||||
</div>
|
<iframe
|
||||||
</LayoutPane>
|
title="Response preview"
|
||||||
|
srcDoc={contentForIframe}
|
||||||
|
sandbox="allow-scripts allow-same-origin"
|
||||||
|
className="h-full w-full rounded-lg"
|
||||||
|
/>
|
||||||
|
) : response?.body ? (
|
||||||
|
<Editor
|
||||||
|
valueKey={`${contentType}:${response.body}`}
|
||||||
|
defaultValue={response?.body}
|
||||||
|
contentType={contentType}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export function VStack({ className, space, children, ...props }: VStackProps) {
|
|||||||
|
|
||||||
interface BaseStackProps extends HTMLAttributes<HTMLElement> {
|
interface BaseStackProps extends HTMLAttributes<HTMLElement> {
|
||||||
items?: 'start' | 'center';
|
items?: 'start' | 'center';
|
||||||
justify?: 'start' | 'end';
|
justify?: 'start' | 'center' | 'end';
|
||||||
as?: React.ElementType;
|
as?: React.ElementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +90,7 @@ function BaseStack({ className, items, justify, as = 'div', ...props }: BaseStac
|
|||||||
items === 'center' && 'items-center',
|
items === 'center' && 'items-center',
|
||||||
items === 'start' && 'items-start',
|
items === 'start' && 'items-start',
|
||||||
justify === 'start' && 'justify-start',
|
justify === 'start' && 'justify-start',
|
||||||
|
justify === 'center' && 'justify-center',
|
||||||
justify === 'end' && 'justify-end',
|
justify === 'end' && 'justify-end',
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ html, body, #root {
|
|||||||
--color-yellow-800: 45 93% 20%;
|
--color-yellow-800: 45 93% 20%;
|
||||||
--color-yellow-900: 45 93% 10%;
|
--color-yellow-900: 45 93% 10%;
|
||||||
|
|
||||||
|
--color-gray-25: 217 21% 98%;
|
||||||
--color-gray-50: 217 21% 95%;
|
--color-gray-50: 217 21% 95%;
|
||||||
--color-gray-100: 217 21% 88%;
|
--color-gray-100: 217 21% 88%;
|
||||||
--color-gray-200: 217 21% 76%;
|
--color-gray-200: 217 21% 76%;
|
||||||
@@ -234,5 +235,6 @@ html, body, #root {
|
|||||||
--color-gray-200: 217 21% 30%;
|
--color-gray-200: 217 21% 30%;
|
||||||
--color-gray-100: 217 21% 25%;
|
--color-gray-100: 217 21% 25%;
|
||||||
--color-gray-50: 217 21% 15%;
|
--color-gray-50: 217 21% 15%;
|
||||||
|
--color-gray-25: 217 21% 10%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function color(name) {
|
function color(name) {
|
||||||
return {
|
const map = {
|
||||||
50: `hsl(var(--color-${name}-50) / <alpha-value>)`,
|
50: `hsl(var(--color-${name}-50) / <alpha-value>)`,
|
||||||
100: `hsl(var(--color-${name}-100) / <alpha-value>)`,
|
100: `hsl(var(--color-${name}-100) / <alpha-value>)`,
|
||||||
200: `hsl(var(--color-${name}-200) / <alpha-value>)`,
|
200: `hsl(var(--color-${name}-200) / <alpha-value>)`,
|
||||||
@@ -46,4 +46,8 @@ function color(name) {
|
|||||||
800: `hsl(var(--color-${name}-800) / <alpha-value>)`,
|
800: `hsl(var(--color-${name}-800) / <alpha-value>)`,
|
||||||
900: `hsl(var(--color-${name}-900) / <alpha-value>)`,
|
900: `hsl(var(--color-${name}-900) / <alpha-value>)`,
|
||||||
}
|
}
|
||||||
|
if (name === 'gray') {
|
||||||
|
map[25] = `hsl(var(--color-${name}-25) / <alpha-value>)`;
|
||||||
|
}
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user