All files / web/src/app/create/worksheets/components/config-panel StudentNameInput.tsx

0% Statements 0/47
0% Branches 0/1
0% Functions 0/1
0% Lines 0/47

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                                               
import { css } from '@styled/css'

export interface StudentNameInputProps {
  value: string | undefined
  onChange: (value: string) => void
  isDark?: boolean
  readOnly?: boolean
}

export function StudentNameInput({
  value,
  onChange,
  isDark = false,
  readOnly = false,
}: StudentNameInputProps) {
  return (
    <input
      type="text"
      value={value || ''}
      onChange={(e) => onChange(e.target.value)}
      placeholder="Student Name"
      readOnly={readOnly}
      className={css({
        w: 'full',
        px: '3',
        py: '2',
        border: '1px solid',
        borderColor: isDark ? 'gray.600' : 'gray.300',
        bg: readOnly ? (isDark ? 'gray.800' : 'gray.100') : isDark ? 'gray.700' : 'white',
        color: isDark ? 'gray.100' : 'gray.900',
        rounded: 'lg',
        fontSize: 'sm',
        opacity: readOnly ? '0.7' : '1',
        cursor: readOnly ? 'not-allowed' : 'text',
        _focus: readOnly
          ? {}
          : {
              outline: 'none',
              borderColor: 'brand.500',
              ring: '2px',
              ringColor: 'brand.200',
            },
        _placeholder: { color: isDark ? 'gray.500' : 'gray.400' },
      })}
    />
  )
}