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

Adding avatar and onClose() on <Citation/> #2562

Merged
merged 5 commits into from
Nov 16, 2023

Conversation

lasryaric
Copy link
Contributor

…ment v1).

@lasryaric lasryaric changed the title Adding action and avatars on the Citation component (for file attache… Adding action and avatar on the Citation component (for file attache… Nov 16, 2023
@@ -13,6 +13,8 @@ interface CitationProps {
index?: ReactNode;
isBlinking?: boolean;
href?: string;
action?: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of action?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking because this is unclear from just reading the code given the very limited typing directive which I think is not ideal for a design system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the existing href property does not let you add a "close" or "delete" action, so we added "action".

I think it makes the API of citation not the best but @Duncid thinks we should keep it as one component as much as we can (vs creating a new component).

We can also create a base component like "Card" and have two other components ContentFragment and Citation that use this one. LMK what you think @spolu .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there is an alternative that both conserve single component and API clarity by replacing href and action by a single "action" prop that is defined out of sparkle. However it requires some more work.

<Citation action={<Citation.Action onClick={} href whatEver/>} />

action can be a Citation.Action or a Button or whatever is requirered.
Citation.Action is just used to privide a "recommendation" of what action should be.
In our case a .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the onClose solution suggested on Slack, happy to revert if you are not happy with it @Duncid but just did that as a "branch prediction" in case you like it.

I updated the code, it still looks the same but I am adding a screenshot to help everybody with context:

Screen Shot 2023-11-16 at 12 17 07

@lasryaric lasryaric changed the title Adding action and avatar on the Citation component (for file attache… Adding avatar and onClose() on <Citation/> Nov 16, 2023
@lasryaric lasryaric requested a review from spolu November 16, 2023 11:24
@lasryaric lasryaric merged commit 2331a63 into main Nov 16, 2023
2 checks passed
@lasryaric lasryaric deleted the aric-sparkle_citaion_action_avatar branch November 16, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants