Ringtone app
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

86 行
1.4 KiB

  1. import {FC} from 'react'
  2. import styled from 'styled-components'
  3. const Base = styled('div')({
  4. borderRadius: '0.25rem',
  5. overflow: 'hidden',
  6. position: 'relative',
  7. backgroundColor: 'var(--color-bg, white)',
  8. '::before': {
  9. content: "''",
  10. borderWidth: 1,
  11. borderStyle: 'solid',
  12. position: 'absolute',
  13. top: 0,
  14. left: 0,
  15. width: '100%',
  16. height: '100%',
  17. borderRadius: 'inherit',
  18. boxSizing: 'border-box',
  19. },
  20. })
  21. const ClickArea = styled('label')({
  22. position: 'relative',
  23. height: '100%',
  24. })
  25. const Label = styled('span')({
  26. position: 'absolute',
  27. left: -999999,
  28. })
  29. const Input = styled('textarea')({
  30. display: 'block',
  31. width: '100%',
  32. minHeight: '3rem',
  33. margin: 0,
  34. padding: '1rem 1rem',
  35. boxSizing: 'border-box',
  36. font: 'inherit',
  37. border: 0,
  38. backgroundColor: 'transparent',
  39. color: 'inherit',
  40. outline: 0,
  41. })
  42. type Props = {
  43. label: string,
  44. name: string,
  45. className?: string,
  46. block?: boolean,
  47. placeholder?: string,
  48. defaultValue?: string | number | readonly string[],
  49. }
  50. const TextArea: FC<Props> = ({
  51. label,
  52. className,
  53. block,
  54. ...etcProps
  55. }) => {
  56. return (
  57. <Base
  58. className={className}
  59. style={{
  60. display: block ? 'block' : 'inline-block',
  61. width: block ? '100%' : undefined,
  62. }}
  63. >
  64. <ClickArea>
  65. <Label>
  66. {label}
  67. </Label>
  68. <Input
  69. {...etcProps}
  70. style={{
  71. resize: block ? 'vertical' : undefined,
  72. }}
  73. />
  74. </ClickArea>
  75. </Base>
  76. )
  77. }
  78. export default TextArea