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

Add type = "success" to Banner component and/or update Banner documentation to include "Toast" #942

Open
bensontrent opened this issue Dec 3, 2023 · 3 comments
Labels
feature-request "Wouldn't it be cool if I could...?"

Comments

@bensontrent
Copy link

bensontrent commented Dec 3, 2023

I'm creating a shipping app that displays a message to the user if there are no shipments that are unshipped. I'm using a banner component. It would be nice if there were a different icon to display to the user when the banner is a positive message. For example, my banner looks out of place here with an exclamation point:

image

It would be nice if the banner displayed a green check mark if the status of the message was positive.

A workaround would be to create a component with an icon and border with the appropriate styling, but this seems like it should be part of the functionality of the Banner component.

@bensontrent bensontrent added feature-request "Wouldn't it be cool if I could...?" needs-triage labels Dec 3, 2023
@gabrielhurley-stripe
Copy link
Contributor

I see your point. The reason this banner type does not exist is because Stripe's own design system guidance is not to use banners to communicate transitory success statuses. Instead we recommend using the Toast component. That info isn't present on the Banner documentation, though, which we can obviously improve.

Hope that helps!

@gabrielhurley-stripe gabrielhurley-stripe changed the title Feature request: Add type = "success" to Banner component Add type = "success" to Banner component and/or update Banner documentation to include "Toast" Jan 22, 2024
@bensontrent
Copy link
Author

bensontrent commented Jan 24, 2024

You can close this issue. I created a positive banner component.

import { Box, Icon, Inline } from "@stripe/ui-extension-sdk/ui";

type PositiveBannerProps = {
    title: React.ReactNode;
    description?: React.ReactNode;
}
const PositiveBanner = ({ title, description }: PositiveBannerProps) => {


  return (
    <Box css={{ marginY: "small", stack:"x", gap:"small", padding:"medium", backgroundColor:"container", borderRadius:"medium" }}>
        <Box css={{width:"1/12", stack:"y", alignSelfY:"center", marginRight:"small"}}><Inline css={{color: 'success'}}><Icon name="checkCircle"/></Inline></Box>
        <Box css={{width:"11/12"}}>
            <Inline css={{fontWeight:"bold"}}>{title}</Inline>
            {description && <Box>{description}</Box>}
        </Box>
   
    </Box>
  );
};

export default PositiveBanner;

Typically my app would display unshipped invoices as a list. The user story here is they need a static notification when there's nothing to ship. In relation to my app, a success banner is the anti "happy-path" as defined in the docs:

image

For example:

image

@bensontrent
Copy link
Author

bensontrent commented Jul 18, 2024

Here's another use case for the "success" type banner: In a private app, we want our administrators to know how to deal with canceled subscriptions with active SIM card ICCIDs on their accounts.

We use:

{obj?.subscription && !iccid && <Banner
          title="No ICCID found"
          type="critical"
          description={obj.subscription.status === "canceled" ? "Nothing more to do here. Canceled subscriptions do not need an ICCID." :
           "Please ask the customer to add an ICCID to the subscription or ask them to cancel their subscription"} 
           />}

We have created a positive banner component but it feels like this is a missed opportunity with the Stripe Apps platform. While we can use our PositiveBanner component when we would like to use:

 {obj?.subscription && !iccid && <Banner
          title="No ICCID found"
          type={obj.subscription.status === "canceled" ? "success" :"critical"}
          description={obj.subscription.status === "canceled" ? "Nothing more to do here. Canceled subscriptions do not need an ICCID." :
           "Please ask the customer to add an ICCID to the subscription or ask them to cancel their subscription"} />}

For an additional use-case reference, Stripe uses a positive banner at https://dashboard.stripe.com/developers:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request "Wouldn't it be cool if I could...?"
Projects
None yet
Development

No branches or pull requests

2 participants