import { Component, ChangeDetectionStrategy } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CardComponent, GlassVariant } from '../../../../../ui-essentials/src/lib/components/data-display/card'; import { ButtonComponent } from '../../../../../ui-essentials/src/lib/components/buttons'; @Component({ selector: 'ui-card-demo', standalone: true, imports: [ CommonModule, CardComponent, ButtonComponent ], changeDetection: ChangeDetectionStrategy.OnPush, template: `

Card Component Showcase

Card Variants

Elevated Card

Default elevated card with shadow

This is the most common card variant with a subtle elevation that lifts it above the surface.

Action

Filled Card

Card with background color

Filled cards use background color to separate content from the surrounding surface.

Action

Outlined Card

Card with border emphasis

Outlined cards use borders to separate content while maintaining a clean appearance.

Action

Size Variants

Small Card

Compact card for minimal content.

Small

Medium Card

Standard card size for most use cases with balanced spacing.

Medium

Large Card

Spacious card for detailed content with generous padding and larger typography.

Large

Elevation Variants

None

No shadow

Small

Subtle shadow

Medium

Moderate shadow

Large

Prominent shadow

Extra Large

Deep shadow

Corner Radius Variants

No Radius

Sharp corners

Small

Subtle rounding

Medium

Standard rounding

Large

Generous rounding

Full

Circle

Interactive States

Clickable Card

Click me!

This card responds to clicks and has hover effects. Try clicking or focusing with keyboard.

Disabled Card

Cannot interact

This card is disabled and cannot be interacted with.

Disabled

Glass Effect Variants

Glass morphism effects using semantic design tokens from the shared-ui library. Each variant offers different levels of transparency and blur effects.

Translucent Glass

Ultra-light transparency

Barely visible background with subtle blur effect for minimal visual interference. Perfect for overlays that need to preserve background visibility.

Translucent

Light Glass

Gentle transparency

Gentle glass effect that maintains excellent readability while adding modern depth. Ideal for cards that need subtle separation from background.

Light

Medium Glass

Balanced effect

Perfect balance between visibility and glass morphism effect. The most versatile variant suitable for most interface components.

Medium

Heavy Glass

Strong presence

Prominent glass effect with substantial background presence. Great for important UI elements that need to stand out prominently.

Heavy

Frosted Glass

Maximum opacity with enhanced blur

Nearly opaque with enhanced blur for a true frosted glass appearance. Perfect for modals, overlays, and primary interface panels.

Frosted

Interactive Glass Cards

Glass effects with full interactivity, smooth animations, and hover states.

Clickable Light Glass

Interactive with smooth animations

Click me! Light glass variant with full interactivity and animation support. Features hover effects and touch feedback.

Clickable Heavy Glass

Strong glass with responsive feedback

Heavy glass variant combining strong visual presence with responsive interactions. Perfect for call-to-action cards and important interactive elements.

Balanced Interactive Glass

Medium glass with keyboard navigation

Medium glass effect with complete accessibility support including keyboard navigation, focus states, and screen reader compatibility.

Glass Implementation Details

Enhanced Glass System: All glass effects now use semantic design tokens from the shared-ui library, ensuring consistent theming, better performance, and improved browser compatibility.

  • Semantic Tokens: Uses @include glass-{{ '{' }}variant{{ '}' }}(true) mixins
  • Animation Support: Built-in smooth transitions and hover effects
  • Accessibility: Proper focus states and keyboard navigation
  • Browser Support: Automatic fallbacks for older browsers
  • Performance: Optimized with will-change and isolation

Background Layer Cards

Gradient Background

Beautiful gradient overlay

This card has a gradient background layer that creates visual depth and interest.

Action

Pattern Background

Custom pattern design

Click me! Cards can have complex patterns and remain fully interactive with proper layering.

Usage Examples

Basic Card:

<ui-card variant="elevated" size="md" elevation="sm" radius="md">
  <div slot="header">
    <h4>Card Title</h4>
    <p>Card subtitle</p>
  </div>
  <p>Card content goes here</p>
  <div slot="footer">
    <ui-button variant="filled">Action</ui-button>
  </div>
</ui-card>

Interactive Card:

<ui-card 
  variant="elevated" 
  [clickable]="true"
  (cardClick)="handleCardClick($event)">
  <p>Click me!</p>
</ui-card>

Glass Effect Card:

<ui-card 
  variant="elevated" 
  [glass]="true"
  glassVariant="medium"
  elevation="md"
  radius="lg">
  <p>Glass morphism effect with semantic tokens</p>
</ui-card>

Glass Variant Examples:

<!-- All glass variants using semantic design tokens -->
<ui-card [glass]="true" glassVariant="translucent">Ultra-light transparency</ui-card>
<ui-card [glass]="true" glassVariant="light">Gentle glass effect</ui-card>
<ui-card [glass]="true" glassVariant="medium">Balanced glass morphism</ui-card>
<ui-card [glass]="true" glassVariant="heavy">Strong visual presence</ui-card>
<ui-card [glass]="true" glassVariant="frosted">Maximum opacity with blur</ui-card>

Interactive Glass Card:

<ui-card 
  variant="elevated" 
  [glass]="true"
  glassVariant="light"
  [clickable]="true"
  (cardClick)="handleCardClick($event)"
  elevation="lg"
  radius="lg">
  <p>Clickable glass card with animations</p>
</ui-card>

Background Layer Card:

<ui-card 
  variant="elevated" 
  [hasBackgroundLayer]="true"
  [hasHeader]="true">
  <div slot="background">
    <!-- Background content -->
  </div>
  <div slot="header">
    <h4>Card with Background</h4>
  </div>
  <p>Content over background</p>
</ui-card>

Interactive Actions

@if (lastAction) {
Last action: {{ lastAction }}
}
Reset Demo Show Alert
`, styles: [` h2 { color: hsl(279, 14%, 11%); font-size: 2rem; margin-bottom: 2rem; border-bottom: 2px solid hsl(258, 100%, 47%); padding-bottom: 0.5rem; } h3 { color: hsl(279, 14%, 25%); font-size: 1.5rem; margin-bottom: 1rem; } h4 { color: hsl(287, 12%, 35%); font-size: 1.125rem; margin-bottom: 0.75rem; } section { border: 1px solid hsl(289, 14%, 90%); border-radius: 8px; padding: 1.5rem; background: hsl(286, 20%, 99%); } pre { font-size: 0.875rem; line-height: 1.5; margin: 0.5rem 0; } code { font-family: 'JetBrains Mono', monospace; color: #d63384; } `] }) export class CardDemoComponent { lastAction: string = ''; handleClick(buttonType: string): void { this.lastAction = `Button clicked: ${buttonType}`; console.log(`Button clicked: ${buttonType}`); } handleCardClick(cardType: string): void { this.lastAction = `Card clicked: ${cardType}`; console.log(`Card clicked: ${cardType}`); } showAlert(message: string): void { alert(message); this.lastAction = 'Alert shown'; } resetDemo(): void { this.lastAction = ''; console.log('Demo reset'); } }