diff --git a/src/components/index.ts b/src/components/index.ts index 7a132e7..37b14e3 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -15,4 +15,5 @@ export { default as LoadingBar } from './LoadingBar/loadingBar.astro'; export { default as NumericStepper } from './numericStepper/numericStepper.astro'; export { default as Avatar } from './Avatar/avatar.astro'; export { default as Select } from './Select/select.astro'; -export { default as SelectOption } from './Select/selectOption.astro'; \ No newline at end of file +export { default as SelectOption } from './Select/selectOption.astro'; +export { default as TextField } from './textField/textField.astro'; \ No newline at end of file diff --git a/src/components/textField/_textField.scss b/src/components/textField/_textField.scss new file mode 100644 index 0000000..a4bca07 --- /dev/null +++ b/src/components/textField/_textField.scss @@ -0,0 +1,30 @@ +@use '../../styles/tokens/typography' as *; + +.textField { + display: flex; + flex-direction: column; + gap: var(--nds-spacing-xs); + &__textarea { + background-color: var(--nds-color-background); + border: var(--nds-border-width-thin) solid var(--nds-text); + border-radius: var(--nds-radius-sm); + padding: var(--nds-spacing-sm) var(--nds-spacing-xs) ; + @include text-base; + color: var(--nds-text); + min-height: 50px; + max-width: 100%; + } + &__charCount { + @include text-sm; + color: var(--nds-text-muted); + text-align: left; + } + &__input { + background-color: var(--nds-color-background); + border: var(--nds-border-width-thin) solid var(--nds-text); + border-radius: var(--nds-radius-sm); + padding: var(--nds-spacing-sm) var(--nds-spacing-xs) ; + @include text-base; + color: var(--nds-text); + } +} \ No newline at end of file diff --git a/src/components/textField/textField.astro b/src/components/textField/textField.astro new file mode 100644 index 0000000..84edda2 --- /dev/null +++ b/src/components/textField/textField.astro @@ -0,0 +1,65 @@ +--- +export interface Props { + id?: string; + label?: string; + type?: 'text' | 'email' | 'password' | 'textarea'; + placeholder?: string; + min?: number; + max?: number; + value?: number; + step?: number; +} + +const { id, label, type = 'text', placeholder, min, max, value, step } = Astro.props; +const charCounter = 0; +--- + +
+ {label && } + {type === 'textarea' ? ( +
+ + {max && ( +
+ {charCounter} / {max} +
+ )} +
+ ) : ( + + )} +
+ + + + \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index a45c5db..211f441 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -15,6 +15,7 @@ import NumericStepper from '../components/numericStepper/numericStepper.astro'; import Avatar from '../components/Avatar/avatar.astro'; import Select from '../components/Select/select.astro'; import SelectOption from '../components/Select/selectOption.astro'; +import TextField from '../components/textField/textField.astro'; import { Arrow2Icon, BinIcon, BurgerIcon, CalendarIcon, CheckIcon, CloseIcon, CodeIcon, CubeIcon, DownloadIcon, FilterIcon, HelpIcon, HomeIcon, @@ -29,6 +30,14 @@ const initialChecked = true;

Nova Design System

+
+

TextField

+
+ + + +
+

Select