-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an integration commit for the virtual branches that GitButler is tracking. Due to GitButler managing multiple virtual branches, you cannot switch back and forth between git branches and virtual branches easily. If you switch to another branch, GitButler will need to be reinitialized. If you commit on this branch, GitButler will throw it away. Here are the branches that are currently applied: - Add status component and variants (refs/gitbutler/Add-status-component-and-variants) - src/ui/Alert/Alert.stories.tsx - src/ui/Button/Button.variants.ts - src/shared/classes.ts - src/layout/Wrapper/Wrapper.variants.ts - src/ui/Plan/Plan.tsx - src/ui/Modal/Modal.variants.ts - src/ui/Plan/Plan.variants.ts - tailwind.config.ts - src/styles/tailwind.css - src/index.ts - src/ui/Plan/Plan.stories.tsx - src/ui/Alert/Alert.tsx - src/ui/Plan/index.ts - Add tailwind and Chromatic CI (refs/gitbutler/Add-tailwind-and-Chromatic-CI-) branch head: bb864771e1c4b08c39d6404ff65c64d6f0a4edaa Your previous branch was: refs/heads/main The sha for that commit was: 4638343 For more information about what we're doing here, check out our docs: https://docs.gitbutler.com/features/virtual-branches/integration-branch
- Loading branch information
1 parent
a250df3
commit 9a7e525
Showing
13 changed files
with
224 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const focusClasses = | ||
"focus-visible:border-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-gray-300 focus-visible:z-10" | ||
"focus-visible:border-gray-500 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-300 focus-visible:z-10" | ||
|
||
export const focusWithinClasses = | ||
"focus-within:border-gray-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-gray-300 focus-within:z-10" | ||
"focus-within:border-gray-500 focus-within:outline-none focus-within:ring-[3px] focus-within:ring-gray-300 focus-within:z-10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
|
||
import { Alert } from "./Alert" | ||
|
||
type Story = StoryObj<typeof Alert> | ||
|
||
// Meta | ||
export default { | ||
title: "UI/Alert", | ||
component: Alert, | ||
args: { | ||
...Alert.defaultProps, | ||
}, | ||
} satisfies Meta | ||
|
||
// Stories | ||
export const Default = { | ||
args: {}, | ||
} satisfies Story |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
|
||
import { Plan } from "./Plan" | ||
|
||
type Story = StoryObj<typeof Plan> | ||
|
||
// Meta | ||
export default { | ||
title: "UI/Plan", | ||
component: Plan, | ||
args: { | ||
...Plan.defaultProps, | ||
}, | ||
} satisfies Meta | ||
|
||
// Stories | ||
export const Default = { | ||
args: {}, | ||
} satisfies Story |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
"use client" | ||
|
||
import { Slot } from "@radix-ui/react-slot" | ||
import { type HTMLAttributes, ReactNode, forwardRef } from "react" | ||
|
||
import { type VariantProps, cx, isReactElement } from "../../shared" | ||
|
||
import { formatIntervalAmount } from "@curiousleaf/utils" | ||
import { IconCheck } from "../../icons/IconCheck" | ||
import { IconClose } from "../../icons/IconClose" | ||
import { H3 } from "../../typography/Heading" | ||
import { Paragraph } from "../../typography/Paragraph" | ||
import { Card } from "../Card" | ||
import { Series } from "../Series" | ||
import { planFeatureCheckVariants, planFeatureVariants, planVariants } from "./Plan.variants" | ||
|
||
export type PlanElement = HTMLDivElement | ||
|
||
export type PlanProps = Omit<HTMLAttributes<PlanElement>, "size"> & | ||
VariantProps<typeof planVariants> & { | ||
/** | ||
* If set to `true`, the button will be rendered as a child within the component. | ||
* This child component must be a valid React component. | ||
*/ | ||
asChild?: boolean | ||
|
||
/** | ||
* The price of the plan. | ||
*/ | ||
price: { | ||
/** | ||
* The unit amount of the price. | ||
*/ | ||
amount: number | ||
|
||
/** | ||
* The interval of the price. | ||
*/ | ||
interval: "month" | "year" | ||
} | ||
|
||
/** | ||
* The name of the plan. | ||
*/ | ||
name: string | ||
|
||
/** | ||
* The description of the plan. | ||
*/ | ||
description?: string | ||
|
||
/** | ||
* The features of the plan. | ||
*/ | ||
features?: { | ||
/** | ||
* The text of the feature. | ||
*/ | ||
text: string | ||
|
||
/** | ||
* The footnote of the feature. | ||
*/ | ||
footnote?: ReactNode | string | ||
|
||
/** | ||
* The type of the feature. | ||
*/ | ||
type?: "positive" | "negative" | ||
}[] | ||
} | ||
|
||
export const Plan = forwardRef<PlanElement, PlanProps>((props, ref) => { | ||
const { children, className, asChild, price, name, description, features, isFeatured, ...rest } = | ||
props | ||
|
||
const useAsChild = asChild && isReactElement(children) | ||
const Component = useAsChild ? Slot : "div" | ||
|
||
return ( | ||
<Card asChild> | ||
<Component ref={ref} className={cx(planVariants({ isFeatured, className }))} {...rest}> | ||
<div className="space-y-3"> | ||
<H3>{name}</H3> | ||
|
||
{description && ( | ||
<Paragraph size="sm" wrap="pretty" className="text-gray-600"> | ||
{description} | ||
</Paragraph> | ||
)} | ||
</div> | ||
|
||
<div className="relative flex flex-wrap items-end gap-1 font-medium"> | ||
<span className="text-xl/none text-gray-400">$</span> | ||
|
||
<span className="text-black text-4xl font-bold !leading-[0.85em]"> | ||
{formatIntervalAmount(price.amount, price.interval)} | ||
</span> | ||
|
||
<div className="text-xs text-gray-500"> | ||
/mo | ||
{price.interval === "year" && <div>billed annually</div>} | ||
</div> | ||
</div> | ||
|
||
{!!features?.length && ( | ||
<Series direction="column" className="mb-auto"> | ||
{features.map(({ type, text }) => ( | ||
<div key={text} className={cx(planFeatureVariants())}> | ||
<Slot className={cx(planFeatureCheckVariants({ type }))}> | ||
{type === "negative" ? <IconClose /> : <IconCheck />} | ||
</Slot> | ||
|
||
<span className={cx(type === "negative" && "text-gray-500")}>{text}</span> | ||
</div> | ||
))} | ||
</Series> | ||
)} | ||
|
||
{children} | ||
</Component> | ||
</Card> | ||
) | ||
}) | ||
|
||
Plan.defaultProps = { | ||
asChild: false, | ||
isFeatured: false, | ||
} | ||
|
||
Plan.displayName = "Plan" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { cva } from "../../shared" | ||
|
||
export const planVariants = cva({ | ||
base: "gap-8 p-4 min-w-64 md:p-6", | ||
|
||
variants: { | ||
isFeatured: { | ||
true: "border-gray-400", | ||
}, | ||
}, | ||
|
||
defaultVariants: { | ||
isFeatured: false, | ||
}, | ||
}) | ||
|
||
export const planFeatureVariants = cva({ | ||
base: "flex gap-3 text-sm", | ||
}) | ||
|
||
export const planFeatureCheckVariants = cva({ | ||
base: "shrink-0 p-1 text-white rounded-smooth", | ||
|
||
variants: { | ||
type: { | ||
positive: "bg-green", | ||
negative: "bg-gray-400", | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Plan" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters