optimizations
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { forwardRef } from 'react'
|
||||
import React, { forwardRef, useId } from 'react'
|
||||
|
||||
/**
|
||||
* Nova Textarea
|
||||
@@ -14,7 +14,11 @@ const Textarea = forwardRef(function Textarea(
|
||||
{ label, error, hint, required, rows = 4, resize = false, id, className = '', ...rest },
|
||||
ref,
|
||||
) {
|
||||
const inputId = id ?? (label ? label.toLowerCase().replace(/\s+/g, '-') : undefined)
|
||||
const generatedId = useId()
|
||||
const labelSlug = typeof label === 'string'
|
||||
? label.toLowerCase().replace(/\s+/g, '-')
|
||||
: null
|
||||
const inputId = id ?? labelSlug ?? `textarea-${generatedId.replace(/[:]/g, '')}`
|
||||
|
||||
const inputClass = [
|
||||
'block w-full rounded-xl border bg-white/[0.06] text-white text-sm',
|
||||
|
||||
Reference in New Issue
Block a user