CoastalCommitsPastes/client/app/(posts)/new/components/title/index.tsx

41 lines
797 B
TypeScript
Raw Normal View History

import { ChangeEvent, memo } from "react"
2022-11-16 03:49:12 -05:00
import Input from "@components/input"
2022-11-18 01:36:53 -05:00
import styles from "./title.module.css"
2022-03-06 19:46:59 -05:00
const titlePlaceholders = [
2022-04-09 20:48:19 -04:00
"How to...",
"Status update for ...",
"My new project",
"My new idea",
"Let's talk about...",
"What's up with ...",
"I'm thinking about ..."
2022-03-06 19:46:59 -05:00
]
const placeholder = titlePlaceholders[3]
2022-03-06 19:46:59 -05:00
type props = {
2022-04-09 20:48:19 -04:00
onChange: (e: ChangeEvent<HTMLInputElement>) => void
title?: string
2022-03-06 19:46:59 -05:00
}
const Title = ({ onChange, title }: props) => {
2022-04-09 20:48:19 -04:00
return (
<div className={styles.title}>
2022-11-18 01:36:53 -05:00
<h1>Drift</h1>
2022-11-16 03:49:12 -05:00
<Input
placeholder={placeholder}
2022-11-20 22:26:07 -05:00
value={title}
2022-11-16 03:49:12 -05:00
onChange={onChange}
2022-11-18 01:36:53 -05:00
label="Title"
className={styles.labelAndInput}
style={{ width: "100%" }}
labelClassName={styles.labelAndInput}
2022-11-16 03:49:12 -05:00
/>
2022-04-09 20:48:19 -04:00
</div>
)
2022-03-06 19:46:59 -05:00
}
export default memo(Title)