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

X2-6273 added smart breakdown item wrapping #246

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
24 changes: 15 additions & 9 deletions src/components/Breakdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ const BreakdownItem = ({ children, info, methodIcon, secondary, value, className

return (
<tr className={clsx("ui-breakdown-item", colors[color], className)} {...rest}>
<td colSpan={2} className="break-all text-left leading-none">
<span className="mr-0.5">{methodIcon}</span>
<span>{children}</span>
<span className="ml-1 text-sm">
{info && (
<span className="mr-2 rounded bg-white p-1 uppercase text-black empty:hidden">{info}</span>
)}
{secondary && <span className="empty:hidden">{secondary}</span>}
</span>
<td colSpan={2} className="text-left leading-none">
<div className="flex flex-wrap items-center leading-3.5">
<span className="break-word">
<span className="mr-0.5">{methodIcon}</span>
{children}
</span>
<span className="ml-1 text-sm">
{info && (
<span className="mr-2 ml-1 rounded bg-white p-1 uppercase leading-6 text-black empty:hidden">
{info}
</span>
Copy link
Member

Choose a reason for hiding this comment

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

Please hold on merging this PR as it will cause conflicts with #309

)}
{secondary && <span className="empty:hidden">{secondary}</span>}
</span>
</div>
</td>

<td className="w-[1%] whitespace-nowrap pl-4 text-right">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const sizes = {
small: "max-w-100", // 400px
medium: "max-w-125", // 500px
large: "max-w-150", // 600px
huge: "max-w-200", // 800px
huge: "max-w-[900px]", // 900px
};

const positions = {
Expand Down
6 changes: 3 additions & 3 deletions src/stories/Other/Breakdown.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Default = () => {
<Breakdown currency="USD">
<Breakdown.Item value={100}>Line item caption</Breakdown.Item>
<Breakdown.Item value={29} secondary="($29.00 x 1)">
Children
Very long really Children
</Breakdown.Item>
<Breakdown.Item value={29} secondary="($29.00 x 1)">
Adults
Expand All @@ -46,12 +46,12 @@ export const Default = () => {
Payment
</Breakdown.Item>

<Breakdown.Item color="primary" secondary="07/23/2021" value={-62} methodIcon={<CardIcon />}>
<Breakdown.Item color="primary" info="*0259" secondary="07/23/2021" value={-62} methodIcon={<CardIcon />}>
Return Payment
</Breakdown.Item>

<Breakdown.Item secondary="07/23/2021" info={<EmptyComponent />} value={0} methodIcon={<CardIcon />}>
This is a really long message that should wrap somehow
This is a really long message that should wrap somehow more long
</Breakdown.Item>

<Breakdown.Separator />
Expand Down
Loading