x-card
delta-components/x-cardFreeComponent
delta-components publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by delta-components on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://deltacomponents.dev/r/x-card.jsonSource
1"use client"23import { type ReactNode } from "react"4import { Tweet } from "react-tweet"56import { cn } from "@/lib/utils"78type XCardSize = "sm" | "small" | "default" | "lg" | "large"910interface XCardProps {11 id: string12 caption?: ReactNode13 className?: string14 size?: XCardSize15}1617function normalizeSize(size: XCardSize): "small" | "default" | "large" {18 if (size === "sm") return "small"19 if (size === "lg") return "large"20 return size as "small" | "default" | "large"21}2223export function XCard({24 id,25 caption,26 className,27 size = "default",28}: XCardProps) {29 const normalizedSize = normalizeSize(size)3031 const sizeClasses = {32 small: "max-w-sm scale-90",33 default: "max-w-xl",34 large: "max-w-2xl scale-110",35 }3637 return (38 <div className={cn("x-card my-6", sizeClasses[normalizedSize], className)}>39 <div className="flex justify-center">40 <Tweet id={id} />41 </div>42 {caption && (43 <div className="text-muted-foreground mt-4 text-center text-sm">44 {caption}45 </div>46 )}47 <style jsx>{`48 .x-card .react-tweet-theme {49 --tweet-container-margin: 0;50 --tweet-font-family: inherit;51 --tweet-font-color: hsl(var(--foreground));52 --tweet-bg-color: hsl(var(--card));53 --tweet-bg-color-hover: hsl(var(--card));54 --tweet-color-blue-secondary: hsl(var(--muted-foreground));55 --tweet-color-blue-secondary-hover: hsl(var(--accent));56 --tweet-font-color-secondary: hsl(var(--muted-foreground));57 --tweet-quoted-bg-color-hover: hsl(var(--muted) / 0.3);58 --tweet-border: 1px solid hsl(var(--border));59 --tweet-skeleton-gradient: linear-gradient(60 270deg,61 hsl(var(--muted)),62 hsl(var(--muted) / 0.8),63 hsl(var(--muted) / 0.8),64 hsl(var(--muted))65 );66 --tweet-color-red-primary: hsl(var(--destructive));67 --tweet-color-red-primary-hover: hsl(var(--destructive) / 0.1);68 --tweet-color-green-primary: hsl(var(--chart-2));69 --tweet-color-green-primary-hover: hsl(var(--chart-2) / 0.1);70 --tweet-twitter-icon-color: hsl(var(--foreground));71 --tweet-verified-old-color: hsl(var(--muted-foreground));72 --tweet-verified-blue-color: hsl(var(--primary));73 }7475 .x-card .react-tweet-theme p {76 font-size: inherit;77 line-height: 1.3rem;78 }7980// … truncated
What it pulls in
npm packages
Files it writes
More from delta-components
All 93 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| admonitionadmonition | delta-components | Components | Free | 1 dep | |
| cambio-imagecambio-image | delta-components | Components | Free | 2 deps | |
| card-deckcard-deck | delta-components | Components | Free | 3 deps | |
| chatchat | delta-components | Components | Free | 3 deps | |
| code-blockcode-block | delta-components | Components | Free | 3 deps | |
| code-block-iconscode-block-icons | delta-components | Components | Free | no deps | |
| copy-buttoncopy-button | delta-components | Components | Free | 1 dep | |
| input-otpinput-otp | delta-components | Components | Free | 1 dep |
