Skip to content

Commit

Permalink
chore: update icon primitive example (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at committed Feb 10, 2022
1 parent d835349 commit 8fe6004
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6422,23 +6422,28 @@ import {
} from \\"@aws-amplify/ui-react/internal\\";
import { Icon, IconProps } from \\"@aws-amplify/ui-react\\";

export type CustomIconProps = React.PropsWithChildren<
export type IconPrimitiveProps = React.PropsWithChildren<
Partial<IconProps> & {
overrides?: EscapeHatchProps | undefined | null;
}
>;
export default function CustomIcon(props: CustomIconProps): React.ReactElement {
export default function IconPrimitive(
props: IconPrimitiveProps
): React.ReactElement {
const { overrides, ...rest } = props;
return (
/* @ts-ignore: TS2322 */
<Icon
ariaLabel=\\"Favorite\\"
viewBox={{ width: 24, height: 24 }}
paths={[
{
d: \\"M18 6V4h2V2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14v-2h-4.03c1.23-.91 2.03-2.36 2.03-4v-5H8v5c0 1.64.81 3.09 2.03 4H6V4h2v2c0 .55.45 1 1 1h8c.55 0 1-.45 1-1z\\",
fill: \\"black\\",
},
]}
{...rest}
{...getOverrideProps(overrides, \\"CustomIcon\\")}
{...getOverrideProps(overrides, \\"IconPrimitive\\")}
></Icon>
);
}
Expand Down
16 changes: 10 additions & 6 deletions packages/codegen-ui/example-schemas/primitives/IconPrimitive.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"id": "1234-5678-9010",
"componentType": "Icon",
"name": "CustomIcon",
"name": "IconPrimitive",
"properties": {
"ariaLabel": {
"value": "Favorite"
},
"viewBox": {
"type": "Object",
"value": "{\"width\": 24, \"height\": 24}"
},
"paths": {
"value": [
{
"d": "M18 6V4h2V2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14v-2h-4.03c1.23-.91 2.03-2.36 2.03-4v-5H8v5c0 1.64.81 3.09 2.03 4H6V4h2v2c0 .55.45 1 1 1h8c.55 0 1-.45 1-1z"
}
]
"type": "Object",
"value": "[{\"d\":\"M18 6V4h2V2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14v-2h-4.03c1.23-.91 2.03-2.36 2.03-4v-5H8v5c0 1.64.81 3.09 2.03 4H6V4h2v2c0 .55.45 1 1 1h8c.55 0 1-.45 1-1z\",\"fill\":\"black\"}]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"type": "Object",
"value": "{\"width\": 24, \"height\": 24}"
},
"pathData": {
"value": "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
"paths": {
"type": "Object",
"value": "[{\"d\":\"M18 6V4h2V2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14v-2h-4.03c1.23-.91 2.03-2.36 2.03-4v-5H8v5c0 1.64.81 3.09 2.03 4H6V4h2v2c0 .55.45 1 1 1h8c.55 0 1-.45 1-1z\",\"fill\":\"black\"}]"
}
}
}

0 comments on commit 8fe6004

Please sign in to comment.