123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import styled, { css } from 'styled-components';
- export interface InputProps {
- inputSize?: 'S' | 'M' | 'L';
- search: boolean;
- }
- const INPUT_SIZES = {
- S: '24px',
- M: '32px',
- L: '40px',
- };
- export const Wrapper = styled.div`
- position: relative;
- &:hover {
- svg:first-child {
- fill: ${({ theme }) => theme.input.icon.hover};
- }
- }
- svg:first-child {
- position: absolute;
- top: 8px;
- line-height: 0;
- z-index: 1;
- left: 12px;
- right: unset;
- height: 16px;
- width: 16px;
- fill: ${({ theme }) => theme.input.icon.color};
- }
- `;
- export const Input = styled.input<InputProps>(
- ({ theme: { input }, inputSize, search }) => css`
- background-color: ${input.backgroundColor.normal};
- border: 1px ${input.borderColor.normal} solid;
- border-radius: 4px;
- color: ${input.color.normal};
- height: ${inputSize && INPUT_SIZES[inputSize]
- ? INPUT_SIZES[inputSize]
- : '40px'};
- width: 100%;
- padding-left: ${search ? '36px' : '12px'};
- font-size: 14px;
- &::placeholder {
- color: ${input.color.placeholder.normal};
- font-size: 14px;
- }
- &:hover {
- border-color: ${input.borderColor.hover};
- }
- &:focus {
- outline: none;
- border-color: ${input.borderColor.focus};
- &::placeholder {
- color: transparent;
- }
- }
- &:disabled {
- color: ${input.color.disabled};
- border-color: ${input.borderColor.disabled};
- background-color: ${input.backgroundColor.disabled};
- cursor: not-allowed;
- }
- &:read-only {
- color: ${input.color.readOnly};
- border: none;
- background-color: ${input.backgroundColor.readOnly};
- &:focus {
- &::placeholder {
- color: ${input.color.placeholder.readOnly};
- }
- }
- cursor: not-allowed;
- }
- `
- );
- export const FormError = styled.p`
- color: ${({ theme }) => theme.input.error};
- font-size: 12px;
- `;
- export const InputHint = styled.p`
- font-size: 0.85rem;
- margin-top: 0.25rem;
- color: ${({ theme }) => theme.clusterConfigForm.inputHintText.secondary};
- `;
|