feat(statuspage): refactor shared styles and modernize components for consistent theming, spacing and APIs
This commit is contained in:
@@ -8,49 +8,63 @@ export const fonts = {
|
||||
export const colors = {
|
||||
// Background colors
|
||||
background: {
|
||||
primary: cssManager.bdTheme('#ffffff', '#0a0a0a'),
|
||||
secondary: cssManager.bdTheme('#f9fafb', '#18181b'),
|
||||
muted: cssManager.bdTheme('#f3f4f6', '#27272a'),
|
||||
card: cssManager.bdTheme('#ffffff', '#18181b')
|
||||
primary: cssManager.bdTheme('#ffffff', '#09090b'),
|
||||
secondary: cssManager.bdTheme('#fafafa', '#18181b'),
|
||||
muted: cssManager.bdTheme('#f4f4f5', '#27272a'),
|
||||
card: cssManager.bdTheme('#ffffff', '#0f0f12'),
|
||||
elevated: cssManager.bdTheme('#ffffff', '#1a1a1e')
|
||||
},
|
||||
|
||||
|
||||
// Border colors
|
||||
border: {
|
||||
default: cssManager.bdTheme('#e5e7eb', '#27272a'),
|
||||
muted: cssManager.bdTheme('#f3f4f6', '#3f3f46')
|
||||
default: cssManager.bdTheme('#e4e4e7', '#27272a'),
|
||||
muted: cssManager.bdTheme('#f4f4f5', '#3f3f46'),
|
||||
subtle: cssManager.bdTheme('#f0f0f2', '#1f1f23')
|
||||
},
|
||||
|
||||
|
||||
// Text colors
|
||||
text: {
|
||||
primary: cssManager.bdTheme('#0a0a0a', '#fafafa'),
|
||||
secondary: cssManager.bdTheme('#6b7280', '#a1a1aa'),
|
||||
muted: cssManager.bdTheme('#9ca3af', '#71717a')
|
||||
primary: cssManager.bdTheme('#09090b', '#fafafa'),
|
||||
secondary: cssManager.bdTheme('#71717a', '#a1a1aa'),
|
||||
muted: cssManager.bdTheme('#a1a1aa', '#71717a')
|
||||
},
|
||||
|
||||
// Status colors - using bright colors for better visibility in both themes
|
||||
|
||||
// Status colors - vibrant and accessible
|
||||
status: {
|
||||
operational: cssManager.bdTheme('#22c55e', '#22c55e'),
|
||||
degraded: cssManager.bdTheme('#fbbf24', '#fbbf24'),
|
||||
partial: cssManager.bdTheme('#f87171', '#f87171'),
|
||||
major: cssManager.bdTheme('#ef4444', '#ef4444'),
|
||||
maintenance: cssManager.bdTheme('#60a5fa', '#60a5fa')
|
||||
operational: cssManager.bdTheme('#16a34a', '#22c55e'),
|
||||
degraded: cssManager.bdTheme('#d97706', '#fbbf24'),
|
||||
partial: cssManager.bdTheme('#dc2626', '#f87171'),
|
||||
major: cssManager.bdTheme('#b91c1c', '#ef4444'),
|
||||
maintenance: cssManager.bdTheme('#2563eb', '#60a5fa')
|
||||
},
|
||||
|
||||
// Accent colors for interactive elements
|
||||
accent: {
|
||||
primary: cssManager.bdTheme('#09090b', '#fafafa'),
|
||||
hover: cssManager.bdTheme('#18181b', '#e4e4e7'),
|
||||
focus: cssManager.bdTheme('#3b82f6', '#60a5fa')
|
||||
}
|
||||
};
|
||||
|
||||
export const shadows = {
|
||||
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
||||
base: '0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06)',
|
||||
md: '0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)',
|
||||
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
||||
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)'
|
||||
xs: '0 1px 2px 0 rgba(0, 0, 0, 0.03)',
|
||||
sm: '0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06)',
|
||||
base: '0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05)',
|
||||
md: '0 6px 12px -2px rgba(0, 0, 0, 0.08), 0 3px 7px -3px rgba(0, 0, 0, 0.05)',
|
||||
lg: '0 12px 24px -4px rgba(0, 0, 0, 0.1), 0 6px 12px -6px rgba(0, 0, 0, 0.05)',
|
||||
xl: '0 24px 48px -12px rgba(0, 0, 0, 0.12), 0 12px 24px -12px rgba(0, 0, 0, 0.05)',
|
||||
inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.04)',
|
||||
glow: '0 0 20px -5px rgba(34, 197, 94, 0.3)'
|
||||
};
|
||||
|
||||
export const borderRadius = {
|
||||
xs: '3px',
|
||||
sm: '4px',
|
||||
base: '6px',
|
||||
md: '8px',
|
||||
lg: '12px',
|
||||
xl: '16px',
|
||||
'2xl': '24px',
|
||||
full: '9999px'
|
||||
};
|
||||
|
||||
@@ -61,7 +75,24 @@ export const spacing = {
|
||||
lg: '24px',
|
||||
xl: '32px',
|
||||
'2xl': '48px',
|
||||
'3xl': '64px'
|
||||
'3xl': '64px',
|
||||
'4xl': '96px'
|
||||
};
|
||||
|
||||
// Animation easings
|
||||
export const easings = {
|
||||
default: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
||||
smooth: 'cubic-bezier(0.4, 0, 0.6, 1)',
|
||||
bounce: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
|
||||
snappy: 'cubic-bezier(0.2, 0, 0, 1)'
|
||||
};
|
||||
|
||||
// Durations
|
||||
export const durations = {
|
||||
fast: '100ms',
|
||||
normal: '200ms',
|
||||
slow: '300ms',
|
||||
slower: '500ms'
|
||||
};
|
||||
|
||||
export const commonStyles = css`
|
||||
@@ -71,78 +102,233 @@ export const commonStyles = css`
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-family: ${unsafeCSS(fonts.base)};
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
height: 36px;
|
||||
padding: 0 16px;
|
||||
padding: 0 14px;
|
||||
border-radius: ${unsafeCSS(borderRadius.base)};
|
||||
border: 1px solid ${colors.border.default};
|
||||
background: transparent;
|
||||
background: ${colors.background.primary};
|
||||
color: ${colors.text.primary};
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: all 0.2s ease;
|
||||
gap: 8px;
|
||||
transition: all ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)};
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
|
||||
.button:hover {
|
||||
background: ${cssManager.bdTheme('#f9fafb', '#262626')};
|
||||
border-color: ${cssManager.bdTheme('#d1d5db', '#404040')};
|
||||
transform: translateY(-1px);
|
||||
background: ${colors.background.secondary};
|
||||
border-color: ${cssManager.bdTheme('#d4d4d8', '#3f3f46')};
|
||||
box-shadow: ${unsafeCSS(shadows.xs)};
|
||||
}
|
||||
|
||||
|
||||
.button:active {
|
||||
transform: translateY(0);
|
||||
transform: scale(0.98);
|
||||
transition-duration: ${unsafeCSS(durations.fast)};
|
||||
}
|
||||
|
||||
|
||||
.button:focus-visible {
|
||||
outline: 2px solid ${colors.accent.focus};
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.button.primary {
|
||||
background: ${colors.text.primary};
|
||||
background: ${colors.accent.primary};
|
||||
color: ${colors.background.primary};
|
||||
border-color: ${colors.text.primary};
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.button.primary:hover {
|
||||
background: ${cssManager.bdTheme('#262626', '#f4f4f5')};
|
||||
border-color: ${cssManager.bdTheme('#262626', '#f4f4f5')};
|
||||
background: ${colors.accent.hover};
|
||||
box-shadow: ${unsafeCSS(shadows.sm)};
|
||||
}
|
||||
|
||||
|
||||
.button.ghost {
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.button.ghost:hover {
|
||||
background: ${colors.background.muted};
|
||||
}
|
||||
|
||||
.button.sm {
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.button.lg {
|
||||
height: 44px;
|
||||
padding: 0 20px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* Card styles */
|
||||
.card {
|
||||
background: ${colors.background.card};
|
||||
border: 1px solid ${colors.border.default};
|
||||
border-radius: ${unsafeCSS(borderRadius.md)};
|
||||
border-radius: ${unsafeCSS(borderRadius.lg)};
|
||||
padding: ${unsafeCSS(spacing.lg)};
|
||||
box-shadow: ${unsafeCSS(shadows.sm)};
|
||||
transition: all ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)};
|
||||
}
|
||||
|
||||
|
||||
.card:hover {
|
||||
border-color: ${colors.border.muted};
|
||||
box-shadow: ${unsafeCSS(shadows.base)};
|
||||
}
|
||||
|
||||
.card.interactive {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card.interactive:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: ${unsafeCSS(shadows.md)};
|
||||
}
|
||||
|
||||
/* Loading skeleton */
|
||||
.skeleton {
|
||||
background: ${cssManager.bdTheme(
|
||||
'linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)',
|
||||
'linear-gradient(90deg, #1f1f1f 25%, #262626 50%, #1f1f1f 75%)'
|
||||
'linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%)',
|
||||
'linear-gradient(90deg, #18181b 0%, #27272a 50%, #18181b 100%)'
|
||||
)};
|
||||
background-size: 200% 100%;
|
||||
animation: skeleton-loading 1.5s infinite;
|
||||
animation: skeleton-loading 1.5s ease-in-out infinite;
|
||||
border-radius: ${unsafeCSS(borderRadius.base)};
|
||||
}
|
||||
|
||||
|
||||
@keyframes skeleton-loading {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
|
||||
/* Pulse animation for status indicators */
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
/* Fade in animation */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(4px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.fade-in {
|
||||
animation: fadeIn ${unsafeCSS(durations.slow)} ${unsafeCSS(easings.default)} forwards;
|
||||
}
|
||||
|
||||
/* Scale in animation */
|
||||
@keyframes scaleIn {
|
||||
from { opacity: 0; transform: scale(0.95); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
|
||||
.scale-in {
|
||||
animation: scaleIn ${unsafeCSS(durations.slow)} ${unsafeCSS(easings.bounce)} forwards;
|
||||
}
|
||||
|
||||
/* Container styles */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 ${unsafeCSS(spacing.lg)};
|
||||
}
|
||||
|
||||
|
||||
/* Status pill */
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
border-radius: ${unsafeCSS(borderRadius.full)};
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.status-pill .status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.status-pill.operational {
|
||||
background: ${cssManager.bdTheme('rgba(22, 163, 74, 0.1)', 'rgba(34, 197, 94, 0.15)')};
|
||||
color: ${cssManager.bdTheme('#15803d', '#4ade80')};
|
||||
}
|
||||
|
||||
.status-pill.operational .status-dot {
|
||||
background: ${colors.status.operational};
|
||||
}
|
||||
|
||||
.status-pill.degraded {
|
||||
background: ${cssManager.bdTheme('rgba(217, 119, 6, 0.1)', 'rgba(251, 191, 36, 0.15)')};
|
||||
color: ${cssManager.bdTheme('#b45309', '#fcd34d')};
|
||||
}
|
||||
|
||||
.status-pill.degraded .status-dot {
|
||||
background: ${colors.status.degraded};
|
||||
}
|
||||
|
||||
.status-pill.partial_outage,
|
||||
.status-pill.major_outage {
|
||||
background: ${cssManager.bdTheme('rgba(220, 38, 38, 0.1)', 'rgba(248, 113, 113, 0.15)')};
|
||||
color: ${cssManager.bdTheme('#b91c1c', '#fca5a5')};
|
||||
}
|
||||
|
||||
.status-pill.partial_outage .status-dot,
|
||||
.status-pill.major_outage .status-dot {
|
||||
background: ${colors.status.major};
|
||||
}
|
||||
|
||||
.status-pill.maintenance {
|
||||
background: ${cssManager.bdTheme('rgba(37, 99, 235, 0.1)', 'rgba(96, 165, 250, 0.15)')};
|
||||
color: ${cssManager.bdTheme('#1d4ed8', '#93c5fd')};
|
||||
}
|
||||
|
||||
.status-pill.maintenance .status-dot {
|
||||
background: ${colors.status.maintenance};
|
||||
}
|
||||
|
||||
/* Responsive utilities */
|
||||
@media (max-width: 1024px) {
|
||||
.container {
|
||||
padding: 0 ${unsafeCSS(spacing.md)};
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.container {
|
||||
padding: 0 ${unsafeCSS(spacing.md)};
|
||||
}
|
||||
|
||||
.button {
|
||||
height: 40px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.button.sm {
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Visually hidden (for accessibility) */
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user