Skip to content

Commit

Permalink
Solidifying types
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio-Laguna committed May 20, 2024
1 parent ddbddd7 commit 93138c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 1 addition & 5 deletions components/icon-picker/icon-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const StyledIconButton = styled(Icon)`
}
`;

export interface IconPickerProps {
export type IconPickerProps = Omit<React.ComponentProps<typeof BaseControl>, 'children'> & {
/**
* Value of the selected icon
*/
Expand All @@ -62,10 +62,6 @@ export interface IconPickerProps {
* Change handler for when a new icon is selected
*/
onChange: (icon: { name: string; iconSet: string }) => void;
/**
* Label of the icon picker
*/
label?: string;
}

export const IconPicker: React.FC<IconPickerProps> = (props) => {
Expand Down
7 changes: 5 additions & 2 deletions example/src/blocks/icon-picker-example/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export function BlockEdit(props) {
const { icon } = attributes;
const blockProps = useBlockProps();

const handleIconSelection = value => setAttributes({icon: { name: value.name, iconSet: value.iconSet }});
const handleIconSelection = (value: {
name: string;
iconSet: string;
}) => setAttributes({icon: { name: value.name, iconSet: value.iconSet }});

return (
<>
Expand All @@ -44,4 +47,4 @@ export function BlockEdit(props) {
</div>
</>
)
}
}

0 comments on commit 93138c7

Please sign in to comment.