mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 04:26:44 +02:00
refactor(shared-ui): convert settings components from scoped CSS to Tailwind
- SettingsCard, SettingsSection, SettingsRow now use Tailwind classes - SettingsToggle, SettingsSelect, SettingsNumberInput updated - SettingsTimeInput, SettingsDangerZone, SettingsDangerButton updated - SettingsPage updated with Tailwind layout classes - Fixes dark mode styling issues when components used across packages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
09599c2a92
commit
76f573fb08
6 changed files with 119 additions and 573 deletions
|
|
@ -30,148 +30,46 @@
|
|||
disabled = false,
|
||||
class: className = '',
|
||||
}: Props = $props();
|
||||
|
||||
// Tailwind classes
|
||||
const baseClasses = 'flex items-center justify-between gap-4 px-5 py-4';
|
||||
const borderClasses = 'border-b border-red-500/[0.12] dark:border-red-500/[0.18] last:border-b-0';
|
||||
const disabledClasses = 'opacity-50 cursor-not-allowed';
|
||||
|
||||
const iconClasses =
|
||||
'flex items-center justify-center flex-shrink-0 w-9 h-9 rounded-[0.625rem] bg-red-500/10 dark:bg-red-500/[0.15] text-red-500 dark:text-red-400 [&>svg]:w-[1.125rem] [&>svg]:h-[1.125rem]';
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="settings-danger-button {border ? 'settings-danger-button--border' : ''} {disabled
|
||||
? 'settings-danger-button--disabled'
|
||||
: ''} {className}"
|
||||
class="{baseClasses} {border ? borderClasses : ''} {disabled ? disabledClasses : ''} {className}"
|
||||
>
|
||||
<div class="settings-danger-button__content">
|
||||
<div class="flex items-center gap-3 flex-1 min-w-0">
|
||||
{#if icon}
|
||||
<span class="settings-danger-button__icon">
|
||||
<span class={iconClasses}>
|
||||
{@render icon()}
|
||||
</span>
|
||||
{/if}
|
||||
<div class="settings-danger-button__text">
|
||||
<span class="settings-danger-button__label">{label}</span>
|
||||
<div class="flex flex-col gap-0.5 min-w-0">
|
||||
<span class="text-[0.9375rem] font-medium text-gray-700 dark:text-gray-100">{label}</span>
|
||||
{#if description}
|
||||
<span class="settings-danger-button__description">{description}</span>
|
||||
<span class="text-[0.8125rem] text-gray-500 dark:text-gray-400 leading-snug"
|
||||
>{description}</span
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" {onclick} class="settings-danger-button__button" {disabled}>
|
||||
<button
|
||||
type="button"
|
||||
{onclick}
|
||||
class="px-4 py-2 text-sm font-medium text-red-500 dark:text-red-400
|
||||
bg-red-500/10 dark:bg-red-500/[0.15] border border-red-500/20 dark:border-red-500/25
|
||||
rounded-lg cursor-pointer flex-shrink-0 transition-all duration-200
|
||||
hover:bg-red-500/20 dark:hover:bg-red-500/25 hover:border-red-500/30 dark:hover:border-red-500/35
|
||||
focus-visible:outline-2 focus-visible:outline-red-500/40 focus-visible:outline-offset-2
|
||||
disabled:cursor-not-allowed"
|
||||
{disabled}
|
||||
>
|
||||
{buttonText || label}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.settings-danger-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding: 1rem 1.25rem;
|
||||
}
|
||||
|
||||
.settings-danger-button--border {
|
||||
border-bottom: 1px solid rgba(239, 68, 68, 0.12);
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button--border {
|
||||
border-bottom-color: rgba(239, 68, 68, 0.18);
|
||||
}
|
||||
|
||||
.settings-danger-button--border:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.settings-danger-button--disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.settings-danger-button__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.settings-danger-button__icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
border-radius: 0.625rem;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: hsl(var(--destructive));
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button__icon {
|
||||
background: rgba(239, 68, 68, 0.15);
|
||||
}
|
||||
|
||||
.settings-danger-button__icon :global(svg) {
|
||||
width: 1.125rem;
|
||||
height: 1.125rem;
|
||||
}
|
||||
|
||||
.settings-danger-button__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.settings-danger-button__label {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button__label {
|
||||
color: #f3f4f6;
|
||||
}
|
||||
|
||||
.settings-danger-button__description {
|
||||
font-size: 0.8125rem;
|
||||
color: #6b7280;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button__description {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.settings-danger-button__button {
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: hsl(var(--destructive));
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border: 1px solid rgba(239, 68, 68, 0.2);
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button__button {
|
||||
background: rgba(239, 68, 68, 0.15);
|
||||
border-color: rgba(239, 68, 68, 0.25);
|
||||
}
|
||||
|
||||
.settings-danger-button__button:hover:not(:disabled) {
|
||||
background: rgba(239, 68, 68, 0.2);
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
:global(.dark) .settings-danger-button__button:hover:not(:disabled) {
|
||||
background: rgba(239, 68, 68, 0.25);
|
||||
border-color: rgba(239, 68, 68, 0.35);
|
||||
}
|
||||
|
||||
.settings-danger-button__button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.settings-danger-button__button:focus-visible {
|
||||
outline: 2px solid rgba(239, 68, 68, 0.4);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue