jedmund-svelte/src/lib/components/admin/FormFieldWrapper.svelte
Justin Edmund a31291d69f refactor: replace deprecated $grey- variables with $gray-
- Replace 802 instances of $grey- variables with $gray- across 106 files
- Remove legacy color aliases from variables.scss
- Maintain consistent naming convention throughout codebase

This completes the migration to the new color scale system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 21:41:50 -04:00

73 lines
1 KiB
Svelte

<script lang="ts">
interface Props {
label: string
required?: boolean
helpText?: string
error?: string
children?: any
}
let { label, required = false, helpText, error, children }: Props = $props()
</script>
<div class="form-field" class:has-error={!!error}>
<label>
{label}
{#if required}
<span class="required">*</span>
{/if}
</label>
{@render children?.()}
{#if helpText}
<p class="help-text">{helpText}</p>
{/if}
{#if error}
<p class="error-text">{error}</p>
{/if}
</div>
<style lang="scss">
.form-field {
margin-bottom: $unit-3x;
&:last-child {
margin-bottom: 0;
}
&.has-error {
:global(input),
:global(textarea),
:global(select) {
border-color: #c33;
}
}
}
label {
display: block;
margin-bottom: $unit;
font-weight: 500;
color: $gray-20;
font-size: 0.925rem;
.required {
color: #c33;
margin-left: 2px;
}
}
.error-text {
margin-top: $unit;
color: #c33;
font-size: 0.875rem;
}
.help-text {
margin-top: $unit;
color: $gray-40;
font-size: 0.875rem;
}
</style>