mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-03 19:37:08 +01:00
#144 put the bot pages on the brand. This does the other 60 files, so the whole product reads as one thing, and adds the guard that keeps it that way. ~410 raw palette classes became semantic tokens across the public marketing surface (/try, /enterprise, /about, /knowledge, /personal, /professionals, /bots, blog, navigation) and the app internals (dashboard, documents, chat, conversations, onboarding, auth, settings, profile). Gradient text is gone. Fifteen headings were `bg-gradient-to-r from-X to-Y bg-clip-text text-transparent`; they are now solid text-ink or text-action. globals.css says the identity is carried by typography, and a serif display does not need a gradient to do that. The 'B' mark was still a blue/purple gradient in BotNavigation's MOBILE menu. #144 only fixed the desktop header. Both now render the shared <Logo>. Three defects introduced mid-sweep and corrected, all caught by reading the diff rather than trusting the regex: - degenerate gradients (`from-action-tint to-action-tint`) collapsed to solid - dead hovers (tint on tint) rebased to bg-surface + hover:bg-action-tint - `to-action\b` matched the prefix of `to-action-hover`, so a collapse left a stray `bg-action-hover` as a BASE background in 11 places -- those are the primary, not the hover shade Deliberately NOT changed: - components/knowledge/Callout.tsx -- its blue is the `info` half of an info/warning/error triad. Semantic status colour is a separate scale from the brand accent, and warning is amber, so ochre-ing info would make the two nearly indistinguishable. - the custom-bot surfaces -- custom_bots.accent_color is a real column with a CHECK constraint and the owner picks it. User data, not a design token. Never-twice: tests/__tests__/lib/design-tokens.test.ts refuses any raw brand-palette class, and any bg-clip-text, outside those two documented exceptions. Mutation-verified -- swap one token back to bg-blue-600 and it fails and names the file. No allowlist debt: every other file was swept rather than excused. verify: format, lint, typecheck, 256 tests, build -- all green. Twelve pages smoke-tested and checked visually against a local production build. Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
185 lines
5.3 KiB
TypeScript
185 lines
5.3 KiB
TypeScript
'use client';
|
|
|
|
import { type FC, type ReactNode } from 'react';
|
|
|
|
/**
|
|
* Feature configuration for bot feature cards
|
|
*/
|
|
export interface BotFeature {
|
|
icon: string;
|
|
title: string;
|
|
description: string;
|
|
/** Optional detailed description shown below main description */
|
|
details?: string;
|
|
/** Gradient color for icon background (Tailwind gradient classes) */
|
|
color?: string;
|
|
}
|
|
|
|
interface BotFeatureCardProps {
|
|
feature: BotFeature;
|
|
/** Optional variant for different styling */
|
|
variant?: 'default' | 'gradient' | 'simple';
|
|
/** Optional click handler for interactive cards */
|
|
onClick?: () => void;
|
|
/** Whether the card is in selected/expanded state */
|
|
isSelected?: boolean;
|
|
/** Optional children for expanded content */
|
|
children?: ReactNode;
|
|
}
|
|
|
|
/**
|
|
* Shared Feature Card component for bot pages
|
|
*
|
|
* Provides consistent styling for feature cards across all bot pages
|
|
* while allowing customization through variants and optional expanded content.
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* // Simple feature card
|
|
* <BotFeatureCard
|
|
* feature={{
|
|
* icon: '🔐',
|
|
* title: 'Secure',
|
|
* description: 'End-to-end encryption',
|
|
* color: 'from-action to-action-hover'
|
|
* }}
|
|
* variant="gradient"
|
|
* />
|
|
*
|
|
* // Interactive card with expanded content
|
|
* <BotFeatureCard
|
|
* feature={feature}
|
|
* variant="simple"
|
|
* onClick={() => setExpanded(!expanded)}
|
|
* isSelected={expanded}
|
|
* >
|
|
* <div>Expanded content here</div>
|
|
* </BotFeatureCard>
|
|
* ```
|
|
*/
|
|
export const BotFeatureCard: FC<BotFeatureCardProps> = ({
|
|
feature,
|
|
variant = 'default',
|
|
onClick,
|
|
isSelected = false,
|
|
children,
|
|
}) => {
|
|
const { icon, title, description, details, color = 'from-gray-500 to-gray-600' } = feature;
|
|
|
|
const baseClasses = 'relative bg-white rounded-2xl p-6 transition-all';
|
|
const interactiveClasses = onClick ? 'cursor-pointer' : '';
|
|
|
|
const variantClasses = {
|
|
default: `${baseClasses} border-2 border-gray-100 hover:border-gray-200 hover:shadow-xl`,
|
|
gradient: `${baseClasses} border-2 border-gray-100 hover:border-gray-200 hover:shadow-xl group`,
|
|
simple: `${baseClasses} border ${
|
|
isSelected
|
|
? 'border-action shadow-md'
|
|
: 'border-gray-200 shadow-sm hover:shadow-md hover:border-gray-300'
|
|
}`,
|
|
};
|
|
|
|
const iconClasses = {
|
|
default: `w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-4`,
|
|
gradient: `w-14 h-14 rounded-xl bg-gradient-to-br ${color} flex items-center justify-center text-2xl text-white mb-4 group-hover:scale-110 transition-transform`,
|
|
simple: `w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-4`,
|
|
};
|
|
|
|
const CardWrapper = onClick ? 'button' : 'div';
|
|
const wrapperProps = onClick
|
|
? {
|
|
onClick,
|
|
type: 'button' as const,
|
|
className: `${variantClasses[variant]} ${interactiveClasses} w-full text-left`,
|
|
}
|
|
: { className: variantClasses[variant] };
|
|
|
|
return (
|
|
<CardWrapper {...wrapperProps}>
|
|
<div className={iconClasses[variant]}>
|
|
<span className={variant === 'gradient' ? '' : 'text-2xl'}>{icon}</span>
|
|
</div>
|
|
<h3
|
|
className={`font-${variant === 'gradient' ? 'bold' : 'semibold'} text-${variant === 'gradient' ? 'xl' : 'lg'} text-gray-900 mb-2`}
|
|
>
|
|
{title}
|
|
</h3>
|
|
<p className={`text-gray-600 ${details ? 'mb-3 font-medium' : ''}`}>{description}</p>
|
|
{details && <p className="text-sm text-gray-500 leading-relaxed">{details}</p>}
|
|
{children}
|
|
</CardWrapper>
|
|
);
|
|
};
|
|
|
|
/**
|
|
* Props for the feature grid component
|
|
*/
|
|
interface BotFeatureGridProps {
|
|
/** Array of features to display */
|
|
features: BotFeature[];
|
|
/** Card variant for all cards in the grid */
|
|
variant?: 'default' | 'gradient' | 'simple';
|
|
/** Number of columns (responsive) */
|
|
columns?: 2 | 3 | 4;
|
|
/** Optional section header */
|
|
header?: {
|
|
badge?: { emoji?: string; text: string };
|
|
title: string;
|
|
subtitle?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Grid layout for multiple feature cards
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* <BotFeatureGrid
|
|
* features={features}
|
|
* variant="gradient"
|
|
* columns={3}
|
|
* header={{
|
|
* badge: { emoji: '⚡', text: 'Platform Features' },
|
|
* title: 'Everything You Need',
|
|
* subtitle: 'Comprehensive tools for your workflow'
|
|
* }}
|
|
* />
|
|
* ```
|
|
*/
|
|
export const BotFeatureGrid: FC<BotFeatureGridProps> = ({
|
|
features,
|
|
variant = 'default',
|
|
columns = 3,
|
|
header,
|
|
}) => {
|
|
const gridCols = {
|
|
2: 'sm:grid-cols-2',
|
|
3: 'sm:grid-cols-2 lg:grid-cols-3',
|
|
4: 'sm:grid-cols-2 lg:grid-cols-4',
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
{header && (
|
|
<div className="text-center mb-12">
|
|
{header.badge && (
|
|
<div className="inline-flex items-center px-4 py-2 bg-action-tint text-action rounded-full text-sm font-medium mb-6">
|
|
{header.badge.emoji && <span className="mr-2">{header.badge.emoji}</span>}
|
|
{header.badge.text}
|
|
</div>
|
|
)}
|
|
<h2 className="text-3xl sm:text-4xl font-bold text-gray-900 mb-4">{header.title}</h2>
|
|
{header.subtitle && (
|
|
<p className="text-lg sm:text-xl text-gray-600 max-w-3xl mx-auto">{header.subtitle}</p>
|
|
)}
|
|
</div>
|
|
)}
|
|
<div className={`grid ${gridCols[columns]} gap-6`}>
|
|
{features.map((feature, idx) => (
|
|
<BotFeatureCard key={idx} feature={feature} variant={variant} />
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|