@olwiba/ui 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +70 -54
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AuthSection.tsx +22 -7
- package/src/components/PricingCard.tsx +18 -3
- package/src/marketing/PricingSection.tsx +10 -1
package/package.json
CHANGED
package/src/app/AuthSection.tsx
CHANGED
|
@@ -27,13 +27,28 @@ const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) =>
|
|
|
27
27
|
|
|
28
28
|
function CenteredAuth({ children, brand, className }: { children: React.ReactNode; brand?: React.ReactNode; className?: string }) {
|
|
29
29
|
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
// `min-h-dvh`, not `min-h-screen`: on mobile `100vh` is the viewport with
|
|
31
|
+
// the browser chrome *retracted*, so a screen-height box is always taller
|
|
32
|
+
// than what you can actually see, and it resizes under you as the URL bar
|
|
33
|
+
// hides and shows.
|
|
34
|
+
<section className={cn('flex min-h-dvh flex-col bg-background px-4 py-10 sm:px-6 sm:py-12 lg:px-8', className)}>
|
|
35
|
+
{/*
|
|
36
|
+
Auto margins rather than `justify-center`, and only from `sm` up.
|
|
37
|
+
|
|
38
|
+
A flex item centred with `justify-center` that's taller than its
|
|
39
|
+
container overflows in *both* directions, and the overflow above the
|
|
40
|
+
top edge is unreachable — no scrolling gets you back to it. That's the
|
|
41
|
+
sign-up form on a phone: name, email, password and social buttons
|
|
42
|
+
already run long, and focusing a field drops the keyboard over half
|
|
43
|
+
the viewport. The top of the card, title included, becomes
|
|
44
|
+
unscrollable.
|
|
45
|
+
|
|
46
|
+
Auto margins collapse to zero when there's no free space, so the card
|
|
47
|
+
stays reachable. Below `sm` there's no vertical centring at all — the
|
|
48
|
+
form flows from the top like the contact page.
|
|
49
|
+
*/}
|
|
50
|
+
<div className="mx-auto w-full max-w-md sm:my-auto">
|
|
51
|
+
{brand && <div className="mb-8 text-center">{brand}</div>}
|
|
37
52
|
{children}
|
|
38
53
|
</div>
|
|
39
54
|
</section>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Check, Minus } from 'lucide-react';
|
|
5
5
|
import { Badge, Button, cn, Separator, useUIVariant } from '@olwiba/cn';
|
|
6
|
-
import { AnimatedSwap } from '../motion/AnimatedSwap';
|
|
6
|
+
import { AnimatedSwap, type AnimatedSwapEffect, type AnimatedSwapSpec } from '../motion/AnimatedSwap';
|
|
7
7
|
|
|
8
8
|
export interface PricingFeature {
|
|
9
9
|
label: string;
|
|
@@ -24,6 +24,15 @@ export interface PricingCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
badge?: React.ReactNode;
|
|
25
25
|
/** Rendered directly below the CTA button (e.g. a "Get notified" link). */
|
|
26
26
|
footer?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* How the price transitions when a cadence toggle swaps it. Omit and the
|
|
29
|
+
* current UI mode decides — `fade` in default, `roll` in playful, `slide` in
|
|
30
|
+
* smooth — which is the right answer for a product that has picked a mode
|
|
31
|
+
* and wants every swap on the page to agree with it. Set it when the price
|
|
32
|
+
* specifically should read as a mechanism (`'roll'`) without moving the
|
|
33
|
+
* whole app to playful.
|
|
34
|
+
*/
|
|
35
|
+
priceEffect?: AnimatedSwapEffect | AnimatedSwapSpec;
|
|
27
36
|
onSelect?: () => void;
|
|
28
37
|
}
|
|
29
38
|
|
|
@@ -39,6 +48,7 @@ export function PricingCard({
|
|
|
39
48
|
ctaDisabled = false,
|
|
40
49
|
badge,
|
|
41
50
|
footer,
|
|
51
|
+
priceEffect,
|
|
42
52
|
onSelect,
|
|
43
53
|
className,
|
|
44
54
|
...props
|
|
@@ -71,8 +81,13 @@ export function PricingCard({
|
|
|
71
81
|
<div className="flex items-end gap-1">
|
|
72
82
|
{/* Animates when a billing-cadence toggle swaps the price out. The
|
|
73
83
|
price is its own swap key: a card whose price never changes never
|
|
74
|
-
animates.
|
|
75
|
-
|
|
84
|
+
animates. `effect` undefined leaves AnimatedSwap on the mode
|
|
85
|
+
default. */}
|
|
86
|
+
<AnimatedSwap
|
|
87
|
+
swapKey={price}
|
|
88
|
+
effect={priceEffect}
|
|
89
|
+
className="text-4xl font-bold tracking-tight"
|
|
90
|
+
>
|
|
76
91
|
{price}
|
|
77
92
|
</AnimatedSwap>
|
|
78
93
|
<span className="mb-1 text-sm text-muted-foreground">{period}</span>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Badge, Button, cn, useUIVariant } from '@olwiba/cn';
|
|
5
|
-
import { PricingCard, type PricingFeature } from '../components/PricingCard';
|
|
5
|
+
import { PricingCard, type PricingCardProps, type PricingFeature } from '../components/PricingCard';
|
|
6
6
|
import { StaggerChildren } from '../motion/StaggerChildren';
|
|
7
7
|
import { CountdownTimer } from '../motion/CountdownTimer';
|
|
8
8
|
import type { AppShellRenderLink } from '../app/AppShell';
|
|
@@ -140,6 +140,13 @@ export interface PricingSectionProps {
|
|
|
140
140
|
onSelectPlan?: (plan: PricingPlan, cadence?: string) => void;
|
|
141
141
|
/** Marks one plan as busy (e.g. its checkout is being created). */
|
|
142
142
|
pendingPlanName?: string;
|
|
143
|
+
/**
|
|
144
|
+
* How each card's price transitions when the cadence toggle changes it.
|
|
145
|
+
* Omit and the current UI mode decides (see `PricingCard.priceEffect`) —
|
|
146
|
+
* pass `'roll'` for an odometer on a product that is otherwise in default
|
|
147
|
+
* mode.
|
|
148
|
+
*/
|
|
149
|
+
priceEffect?: PricingCardProps['priceEffect'];
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) => (
|
|
@@ -164,6 +171,7 @@ export function PricingSection({
|
|
|
164
171
|
defaultCadence,
|
|
165
172
|
onSelectPlan,
|
|
166
173
|
pendingPlanName,
|
|
174
|
+
priceEffect,
|
|
167
175
|
}: PricingSectionProps) {
|
|
168
176
|
const [annual, setAnnual] = React.useState(false);
|
|
169
177
|
const isOneTime = mode === 'one-time';
|
|
@@ -314,6 +322,7 @@ export function PricingSection({
|
|
|
314
322
|
ctaDisabled={plan.ctaDisabled || pendingPlanName === plan.name}
|
|
315
323
|
badge={badge}
|
|
316
324
|
footer={renderPlanFooter?.(plan)}
|
|
325
|
+
priceEffect={priceEffect}
|
|
317
326
|
onSelect={
|
|
318
327
|
onSelectPlan
|
|
319
328
|
? () => onSelectPlan(plan, useCadences ? activeCadence : undefined)
|