Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export field icon types object #686

Open
chrisvxd opened this issue Nov 7, 2024 · 3 comments
Open

Export field icon types object #686

chrisvxd opened this issue Nov 7, 2024 · 3 comments
Labels
ready Assumed ready enough to start type: feature

Comments

@chrisvxd
Copy link
Member

chrisvxd commented Nov 7, 2024

A user must currently specify their own icon when using FieldLabel. This makes it awkward to use with AutoField, as the user has to redefine the icons for their field type.

Proposal

Add a fieldIcons export that maps the nodes to the field types. We should also use these internally to ensure consistency.

const fieldIcons = {
  text: <Heading size="16" />
}

The user can then use them alongside the FieldLabel API

<FieldLabel icon={fieldIcons.text} label="My Label">
  <AutoField ... />
</FieldLabel>
@IMythx
Copy link
Contributor

IMythx commented Nov 7, 2024

@chrisvxd what about specifying the field type instead? e.g

<FieldLabel type='text'>
   <AutoField ... />
</FieldLabel>

And depending on the type you would show the proper icon.
If the user don't provide the type then he should provide his own icon and ofc his icon has the priority over the puck icons incase he provide the type and the icon at the same time

@chrisvxd
Copy link
Member Author

I suppose we could also use that to address the array item deletion bug 🤔

@IMythx
Copy link
Contributor

IMythx commented Nov 12, 2024

I suppose we could also use that to address the array item deletion bug 🤔

yup i think so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Assumed ready enough to start type: feature
Projects
None yet
Development

No branches or pull requests

2 participants