Fix Select styling

This commit is contained in:
Mathias Wagner
2025-09-09 14:23:12 +02:00
parent 8fe30668e0
commit 3bb2dcabaf
2 changed files with 49 additions and 15 deletions

View File

@@ -12,10 +12,10 @@ export const Select = ({
...rest ...rest
}) => { }) => {
return ( return (
<div className={`field ${containerClassName || ''}`}> <div className={`select-field ${containerClassName || ''}`}>
{label && <label className="field-label">{label}</label>} {label && <label className="select-label">{label}</label>}
<div className={`field-control has-icon ${error ? 'has-error' : ''} ${className || ''}`}> <div className={`select-container ${error ? 'select-error' : ''} ${className || ''}`}>
<select className="field-select" {...rest}> <select className="select-input" {...rest}>
{placeholder && ( {placeholder && (
<option value="" disabled> <option value="" disabled>
{placeholder} {placeholder}
@@ -27,11 +27,11 @@ export const Select = ({
</option> </option>
))} ))}
</select> </select>
<span className="field-icon field-icon--right"> <div className="select-icon">
<CaretDownIcon size={16} /> <CaretDownIcon size={16} />
</span> </div>
</div> </div>
{error && <div className="field-error">{error}</div>} {error && <div className="select-error-text">{error}</div>}
</div> </div>
); );
}; };

View File

@@ -1,4 +1,34 @@
.field-select .select-field
display: flex
flex-direction: column
gap: 0.5rem
font-size: 0.9rem
font-weight: 600
color: #374048
.select-label
letter-spacing: 0.3px
margin-bottom: 0.2rem
.select-container
position: relative
display: flex
align-items: center
background: #ffffff
border: 2px solid #e1e8f0
border-radius: 16px
transition: all 0.2s ease
&.select-error
border-color: #d93025
box-shadow: 0 0 0 4px rgba(217, 48, 37, 0.1)
&:focus-within
border-color: #0f62fe
box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.1)
transform: translateY(-1px)
.select-input
appearance: none appearance: none
background: transparent background: transparent
border: 0 border: 0
@@ -10,21 +40,25 @@
line-height: 1.3 line-height: 1.3
outline: none outline: none
cursor: pointer cursor: pointer
padding-right: 2.5rem padding: 1rem 1.2rem
&:focus
outline: none
&:disabled &:disabled
opacity: 0.6 opacity: 0.6
cursor: not-allowed cursor: not-allowed
.field-control.has-icon .field-icon--right .select-icon
position: absolute position: absolute
right: 1rem right: 1rem
top: 50% top: 50%
transform: translateY(-50%) transform: translateY(-50%)
pointer-events: none pointer-events: none
color: var(--text-dim) color: var(--text-dim)
display: inline-flex display: flex
z-index: 1 align-items: center
justify-content: center
.select-error-text
font-size: 0.65rem
font-weight: 600
color: #d93025
letter-spacing: 0.5px