Skip to content

Commit

Permalink
fix(iconify-input): handle empty collections and showName options
Browse files Browse the repository at this point in the history
chore(types): export BaseSchemaDefinition and IconPrefix types
  • Loading branch information
waspeer committed Sep 18, 2023
1 parent 26bd34c commit 0467b16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/iconify-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export function IconifyInput(props: IconifyInputProps) {
const prettyName = usePrettyIconName(selectedIcon);

const options: IconOptions = schemaType.options;
const collections = options?.collections ?? config?.collections ?? null;
const collections =
(!options?.collections?.length && options.collections) ||
(!config?.collections?.length && config.collections) ||
null;
const showName = options?.showName ?? config?.showName ?? false;

const handleSelect = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { BaseSchemaDefinition } from 'sanity';
// If this line errors, the type definitions have not been generated.
import type { IconPrefix } from './icon-types.gen';

// Export types that need to be bundled with the plugin
export type { BaseSchemaDefinition } from 'sanity';
export type { IconPrefix };

export interface IconOptions {
Expand Down

0 comments on commit 0467b16

Please sign in to comment.