Skip to content

Conversation

@camielvs
Copy link
Collaborator

@camielvs camielvs commented Dec 4, 2025

Description

Adds standard UI blocks for use inside the ContextPanel. Hopefully this will allow us a bit more visual consistency going forward. Each block has a header/title and some content. The header is the same for all blocks, but the content will be different depending on the block.

Implementation of the Blocks into existing Context Panel use cases is done upstack.

Blocks Added:

  • ActionBlock: Renders a horizontal array of identical buttons based on an input label, icon and callback. Custom configuration options allow buttons to be hidden or disabled upon certain conditions, or to have two-step confirmation.
  • ContentBlock: Renders any given ReactNode content. An optional prop allows the block to be collapsed.
  • ListBlock: Renders a list of key:value pair items. Items can be with or without markers. Items without a value will not render in the list
  • TextBlock: Renders text. Text can be copyable or collapsible via optional props

Additionally, the Attribute component was added, which simply renders a given label and associated value. Value can be a string or a link.

This PR also adds unit tests to the new Blocks.

Related Issue and Pull requests

https://github.com/Shopify/oasis-frontend/issues/401

Type of Change

  • Improvement
  • Cleanup/Refactor

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

This PR adds new UI blocks but does not implement them in the interface. If you want to test them and see what they look like visual:

  • Add a test component in the code and see how it renders, or
  • Go upstack to the cleanup PRs and see them in action

(wouldn't it be neat to have a UI playground?)

Additional Comments

@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from ed2e0a6 to e08a5ab Compare December 4, 2025 21:52
This was referenced Dec 4, 2025
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from e08a5ab to 54e3528 Compare December 4, 2025 21:59
@camielvs camielvs mentioned this pull request Dec 4, 2025
3 tasks
@camielvs camielvs changed the base branch from master to graphite-base/1470 December 4, 2025 22:44
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from 54e3528 to e6ea5d1 Compare December 4, 2025 22:44
@camielvs camielvs changed the base branch from graphite-base/1470 to 12-04-update_link_component December 4, 2025 22:44
@camielvs camielvs mentioned this pull request Dec 4, 2025
3 tasks
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from e6ea5d1 to 87a5600 Compare December 4, 2025 22:47
@camielvs camielvs force-pushed the 12-04-update_link_component branch from ecc2b18 to ebfc92f Compare December 5, 2025 01:53
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from 87a5600 to 8f16f7a Compare December 5, 2025 01:53
@camielvs camielvs changed the base branch from 12-04-update_link_component to graphite-base/1470 December 5, 2025 20:26
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from 8f16f7a to a526425 Compare December 8, 2025 23:41
@camielvs camielvs changed the base branch from graphite-base/1470 to master December 8, 2025 23:41
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 3 times, most recently from d385e99 to 66a011a Compare December 9, 2025 02:09
@camielvs camielvs mentioned this pull request Dec 9, 2025
3 tasks
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 5 times, most recently from 1d45169 to 1cb8f58 Compare December 10, 2025 21:28
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 2 times, most recently from 4814e7c to 4821940 Compare December 11, 2025 00:34
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 2 times, most recently from 7f0ee6f to f3260f1 Compare December 12, 2025 00:44
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 2 times, most recently from 436b867 to d89ccdb Compare December 13, 2025 00:23
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 2 times, most recently from 6dcfcb1 to c063c0a Compare December 15, 2025 20:25
@camielvs camielvs marked this pull request as ready for review December 15, 2025 21:14
},
});

export type IconName = keyof typeof icons;
Copy link
Collaborator

Choose a reason for hiding this comment

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

love it!

@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from c063c0a to d93cd57 Compare December 17, 2025 19:02
@camielvs camielvs requested a review from a team as a code owner December 17, 2025 19:02
@camielvs camielvs requested a review from maxy-shpfy December 17, 2025 20:27
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch 2 times, most recently from da65e9c to abf1484 Compare December 17, 2025 20:34
@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from abf1484 to 49b752e Compare December 18, 2025 16:03
Copy link
Collaborator

@maxy-shpfy maxy-shpfy left a comment

Choose a reason for hiding this comment

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

LGTM!

<CollapsibleTrigger asChild>
<Button variant="ghost" size="sm">
<Icon name="ChevronsUpDown" />
<span className="sr-only">Toggle</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future: interesting, that we may need to take it further one day, and apply a11y

Comment on lines +57 to +74
<BlockStack className={className}>
<Collapsible className="w-full">
<InlineStack blockAlign="center" gap="1">
{title && <Heading level={3}>{title}</Heading>}
{collapsible && (
<CollapsibleTrigger asChild>
<Button variant="ghost" size="sm">
<Icon name="ChevronsUpDown" />
<span className="sr-only">Toggle</span>
</Button>
</CollapsibleTrigger>
)}
</InlineStack>

{collapsible ? (
<CollapsibleContent className="w-full mt-1">
{content}
</CollapsibleContent>
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: this block looks really similar to the ContentBlock - maybe we can re-use code pieces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about it but didn't want to over-complicate things. We can do as a follow-up if we feel it's necessary

@camielvs camielvs force-pushed the 12-04-add_ui_blocks_to_context_panel branch from 49b752e to a8add58 Compare December 18, 2025 19:28
const key =
isValidElement(action) && action.key != null
? `action-node-${String(action.key)}`
: `action-node-${index}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm ok with this for now (since in nature action list is pretty static, so we should not see issues related to key messed up), but I would revisit and see if we can use smth like "ID" on the Action structure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the long-term this may likely be removed - i.e. in #1544

Copy link
Collaborator Author

camielvs commented Dec 18, 2025

Merge activity

  • Dec 18, 8:34 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 18, 8:34 PM UTC: @camielvs merged this pull request with Graphite.

@camielvs camielvs merged commit 18afa99 into master Dec 18, 2025
7 of 9 checks passed
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.

4 participants