Skip to content

Commit

Permalink
shadcn
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Sep 21, 2024
1 parent 268afb7 commit a8496b4
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/www/src/components/_block-display.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getBlock } from '@/lib/_blocks';
import { styles } from '@/registry/styles';
import { styles } from '@/registry/registry-styles';

import { BlockPreview } from './block-preview';

Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/components/component-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { cn } from '@udecode/cn';

import { Index } from '@/__registry__';
import { useConfig } from '@/hooks/use-config';
import { styles } from '@/registry/styles';
import { styles } from '@/registry/registry-styles';

import { CopyButton } from './copy-button';
import { Icons } from './icons';
Expand Down
8 changes: 4 additions & 4 deletions apps/www/src/components/copy-code-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
DialogTitle,
DialogTrigger,
} from '@/registry/default/plate-ui/dialog';
import { type Theme, themes } from '@/registry/themes';
import { type BaseColor, baseColors } from '@/registry/registry-base-colors';

import { copyToClipboardWithMeta } from './copy-button';

Expand All @@ -23,7 +23,7 @@ export function CopyCodeButton({
...props
}: React.ComponentProps<typeof Button>) {
const [config] = useConfig();
const activeTheme = themes.find((theme) => theme.name === config.theme);
const activeTheme = baseColors.find((theme) => theme.name === config.theme);
const [hasCopied, setHasCopied] = React.useState(false);

React.useEffect(() => {
Expand Down Expand Up @@ -107,7 +107,7 @@ export function CopyCodeButton({

function CustomizerCode() {
const [config] = useConfig();
const activeTheme = themes.find((theme) => theme.name === config.theme);
const activeTheme = baseColors.find((theme) => theme.name === config.theme);

return (
<div className="relative space-y-4">
Expand Down Expand Up @@ -230,7 +230,7 @@ function CustomizerCode() {
);
}

function getThemeCode(theme: Theme, radius: number) {
function getThemeCode(theme: BaseColor, radius: number) {
if (!theme) {
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/components/style-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { SelectTriggerProps } from '@radix-ui/react-select';
import { cn } from '@udecode/cn';

import { useConfig } from '@/hooks/use-config';
import { type Style, styles } from '@/registry/styles';
import { type Style, styles } from '@/registry/registry-styles';

import {
Select,
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/components/style-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';

import type { Style } from '@/registry/styles';
import type { Style } from '@/registry/registry-styles';

import { useConfig } from '@/hooks/use-config';

Expand Down
1 change: 1 addition & 0 deletions apps/www/src/components/theme-customizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
TooltipContent,
TooltipTrigger,
} from '@/registry/default/plate-ui/tooltip';
import { type BaseColor, baseColors } from '@/registry/registry-base-colors';

import { copyToClipboardWithMeta } from './copy-button';
import { ThemeWrapper } from './theme-wrapper';
Expand Down
4 changes: 2 additions & 2 deletions apps/www/src/components/themes-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TooltipContent,
TooltipTrigger,
} from '@/registry/default/plate-ui/tooltip';
import { themes } from '@/registry/themes';
import { baseColors } from '@/registry/registry-base-colors';

import { settingsStore } from './context/settings-store';
import { Skeleton } from './ui/skeleton';
Expand All @@ -34,7 +34,7 @@ export function ThemesButton() {
{mounted ? (
<>
{['slate', 'rose', 'blue', 'green', 'orange'].map((color) => {
const theme = themes.find((th) => th.name === color);
const theme = baseColors.find((th) => th.name === color);
const isActive = config.theme === color;

if (!theme) {
Expand Down
2 changes: 2 additions & 0 deletions apps/www/src/components/themes-styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use client';

import { useThemesConfig } from '@/hooks/use-themes-config';

export function ThemesStyle() {
const { themesConfig } = useThemesConfig();

Expand Down
4 changes: 2 additions & 2 deletions apps/www/src/components/themes-tab-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
PopoverContent,
PopoverTrigger,
} from '@/registry/default/plate-ui/popover';
import { themes } from '@/registry/themes';
import { baseColors } from '@/registry/registry-base-colors';

import { CopyCodeButton } from './copy-code-button';
import { Label } from './ui/label';
Expand Down Expand Up @@ -109,7 +109,7 @@ export function ThemesTabContent() {
<div className="space-y-1.5">
<Label className="text-xs">Color</Label>
<div className="grid grid-cols-3 gap-2">
{themes.map((theme) => {
{baseColors.map((theme) => {
const isActive = config.theme === theme.name;

return mounted ? (
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/components/typography.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import type { Event } from '@/lib/events';
import type { Style } from '@/registry/styles';
import type { Style } from '@/registry/registry-styles';
import type { NpmCommands } from '@/types/unist';

import { cn } from '@udecode/cn';
Expand Down
3 changes: 2 additions & 1 deletion apps/www/src/hooks/use-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Style } from '@/registry/styles';
import type { BaseColor } from '@/registry/registry-base-colors';
import type { Style } from '@/registry/registry-styles';

import { useAtom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/lib/_blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/require-await */
'use server';

import type { Style } from '@/registry/styles';
import type { Style } from '@/registry/registry-styles';

import { promises as fs } from 'node:fs';
import { tmpdir } from 'node:os';
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/registry/registry-base-colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,4 +633,4 @@ export const baseColors = [
},
] as const;

export type BaseTheme = (typeof baseColors)[number];
export type BaseColor = (typeof baseColors)[number];
4 changes: 2 additions & 2 deletions apps/www/src/registry/registry-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ export const examples: Registry = [
external: true,
files: ['styles/globals.css'],
name: 'globals',
type: 'components:component',
type: 'registry:style',
},
{
external: true,
files: ['types/plate-types.ts'],
name: 'plate-types',
type: 'components:component',
type: 'registry:lib',
},
];

0 comments on commit a8496b4

Please sign in to comment.