refactor text input into one component (#1016)
* Add responsive text input component * Add styled expanding textarea component
This commit is contained in:
parent
dc51e2cf46
commit
8d06e4b4d2
|
@ -6,6 +6,7 @@ import { Col } from './layout/col'
|
||||||
import { ENV_CONFIG } from 'common/envs/constants'
|
import { ENV_CONFIG } from 'common/envs/constants'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { AddFundsModal } from './add-funds-modal'
|
import { AddFundsModal } from './add-funds-modal'
|
||||||
|
import { Input } from './input'
|
||||||
|
|
||||||
export function AmountInput(props: {
|
export function AmountInput(props: {
|
||||||
amount: number | undefined
|
amount: number | undefined
|
||||||
|
@ -44,9 +45,9 @@ export function AmountInput(props: {
|
||||||
<span className="text-greyscale-4 absolute top-1/2 my-auto ml-2 -translate-y-1/2">
|
<span className="text-greyscale-4 absolute top-1/2 my-auto ml-2 -translate-y-1/2">
|
||||||
{label}
|
{label}
|
||||||
</span>
|
</span>
|
||||||
<input
|
<Input
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'placeholder:text-greyscale-4 border-greyscale-2 rounded-md pl-9',
|
'pl-9',
|
||||||
error && 'input-error',
|
error && 'input-error',
|
||||||
'w-24 md:w-auto',
|
'w-24 md:w-auto',
|
||||||
inputClassName
|
inputClassName
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { formatPercent } from 'common/util/format'
|
||||||
import { getDpmOutcomeProbability } from 'common/calculate-dpm'
|
import { getDpmOutcomeProbability } from 'common/calculate-dpm'
|
||||||
import { tradingAllowed } from 'web/lib/firebase/contracts'
|
import { tradingAllowed } from 'web/lib/firebase/contracts'
|
||||||
import { Linkify } from '../linkify'
|
import { Linkify } from '../linkify'
|
||||||
|
import { Input } from '../input'
|
||||||
|
|
||||||
export function AnswerItem(props: {
|
export function AnswerItem(props: {
|
||||||
answer: Answer
|
answer: Answer
|
||||||
|
@ -74,8 +75,8 @@ export function AnswerItem(props: {
|
||||||
<Row className="items-center justify-end gap-4 self-end sm:self-start">
|
<Row className="items-center justify-end gap-4 self-end sm:self-start">
|
||||||
{!wasResolvedTo &&
|
{!wasResolvedTo &&
|
||||||
(showChoice === 'checkbox' ? (
|
(showChoice === 'checkbox' ? (
|
||||||
<input
|
<Input
|
||||||
className="input input-bordered w-24 justify-self-end text-2xl"
|
className="w-24 justify-self-end !text-2xl"
|
||||||
type="number"
|
type="number"
|
||||||
placeholder={`${roundedProb}`}
|
placeholder={`${roundedProb}`}
|
||||||
maxLength={9}
|
maxLength={9}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import { findBestMatch } from 'string-similarity'
|
import { findBestMatch } from 'string-similarity'
|
||||||
|
|
||||||
import { FreeResponseContract } from 'common/contract'
|
import { FreeResponseContract } from 'common/contract'
|
||||||
|
@ -26,6 +25,7 @@ import { MAX_ANSWER_LENGTH } from 'common/answer'
|
||||||
import { withTracking } from 'web/lib/service/analytics'
|
import { withTracking } from 'web/lib/service/analytics'
|
||||||
import { lowerCase } from 'lodash'
|
import { lowerCase } from 'lodash'
|
||||||
import { Button } from '../button'
|
import { Button } from '../button'
|
||||||
|
import { ExpandingInput } from '../expanding-input'
|
||||||
|
|
||||||
export function CreateAnswerPanel(props: { contract: FreeResponseContract }) {
|
export function CreateAnswerPanel(props: { contract: FreeResponseContract }) {
|
||||||
const { contract } = props
|
const { contract } = props
|
||||||
|
@ -122,10 +122,10 @@ export function CreateAnswerPanel(props: { contract: FreeResponseContract }) {
|
||||||
<Col className="gap-4 rounded">
|
<Col className="gap-4 rounded">
|
||||||
<Col className="flex-1 gap-2 px-4 xl:px-0">
|
<Col className="flex-1 gap-2 px-4 xl:px-0">
|
||||||
<div className="mb-1">Add your answer</div>
|
<div className="mb-1">Add your answer</div>
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
value={text}
|
value={text}
|
||||||
onChange={(e) => changeAnswer(e.target.value)}
|
onChange={(e) => changeAnswer(e.target.value)}
|
||||||
className="textarea textarea-bordered w-full resize-none"
|
className="w-full"
|
||||||
placeholder="Type your answer..."
|
placeholder="Type your answer..."
|
||||||
rows={1}
|
rows={1}
|
||||||
maxLength={MAX_ANSWER_LENGTH}
|
maxLength={MAX_ANSWER_LENGTH}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { MAX_ANSWER_LENGTH } from 'common/answer'
|
import { MAX_ANSWER_LENGTH } from 'common/answer'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import { XIcon } from '@heroicons/react/solid'
|
import { XIcon } from '@heroicons/react/solid'
|
||||||
import { Col } from '../layout/col'
|
import { Col } from '../layout/col'
|
||||||
import { Row } from '../layout/row'
|
import { Row } from '../layout/row'
|
||||||
|
import { ExpandingInput } from '../expanding-input'
|
||||||
|
|
||||||
export function MultipleChoiceAnswers(props: {
|
export function MultipleChoiceAnswers(props: {
|
||||||
answers: string[]
|
answers: string[]
|
||||||
|
@ -27,10 +27,10 @@ export function MultipleChoiceAnswers(props: {
|
||||||
{answers.map((answer, i) => (
|
{answers.map((answer, i) => (
|
||||||
<Row className="mb-2 items-center gap-2 align-middle">
|
<Row className="mb-2 items-center gap-2 align-middle">
|
||||||
{i + 1}.{' '}
|
{i + 1}.{' '}
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
value={answer}
|
value={answer}
|
||||||
onChange={(e) => setAnswer(i, e.target.value)}
|
onChange={(e) => setAnswer(i, e.target.value)}
|
||||||
className="textarea textarea-bordered ml-2 w-full resize-none"
|
className="ml-2 w-full"
|
||||||
placeholder="Type your answer..."
|
placeholder="Type your answer..."
|
||||||
rows={1}
|
rows={1}
|
||||||
maxLength={MAX_ANSWER_LENGTH}
|
maxLength={MAX_ANSWER_LENGTH}
|
||||||
|
|
|
@ -20,11 +20,11 @@ import { getProbability } from 'common/calculate'
|
||||||
import { createMarket } from 'web/lib/firebase/api'
|
import { createMarket } from 'web/lib/firebase/api'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from 'common/util/object'
|
||||||
import { FIXED_ANTE } from 'common/economy'
|
import { FIXED_ANTE } from 'common/economy'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import { useTextEditor } from 'web/components/editor'
|
import { useTextEditor } from 'web/components/editor'
|
||||||
import { LoadingIndicator } from 'web/components/loading-indicator'
|
import { LoadingIndicator } from 'web/components/loading-indicator'
|
||||||
import { track } from 'web/lib/service/analytics'
|
import { track } from 'web/lib/service/analytics'
|
||||||
import { CopyLinkButton } from '../copy-link-button'
|
import { CopyLinkButton } from '../copy-link-button'
|
||||||
|
import { ExpandingInput } from '../expanding-input'
|
||||||
|
|
||||||
type challengeInfo = {
|
type challengeInfo = {
|
||||||
amount: number
|
amount: number
|
||||||
|
@ -153,9 +153,9 @@ function CreateChallengeForm(props: {
|
||||||
{contract ? (
|
{contract ? (
|
||||||
<span className="underline">{contract.question}</span>
|
<span className="underline">{contract.question}</span>
|
||||||
) : (
|
) : (
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
placeholder="e.g. Will a Democrat be the next president?"
|
placeholder="e.g. Will a Democrat be the next president?"
|
||||||
className="input input-bordered mt-1 w-full resize-none"
|
className="mt-1 w-full"
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
maxLength={MAX_QUESTION_LENGTH}
|
maxLength={MAX_QUESTION_LENGTH}
|
||||||
value={challengeInfo.question}
|
value={challengeInfo.question}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import { AdjustmentsIcon } from '@heroicons/react/solid'
|
||||||
import { Button } from './button'
|
import { Button } from './button'
|
||||||
import { Modal } from './layout/modal'
|
import { Modal } from './layout/modal'
|
||||||
import { Title } from './title'
|
import { Title } from './title'
|
||||||
|
import { Input } from './input'
|
||||||
|
|
||||||
export const SORTS = [
|
export const SORTS = [
|
||||||
{ label: 'Newest', value: 'newest' },
|
{ label: 'Newest', value: 'newest' },
|
||||||
|
@ -438,13 +439,13 @@ function ContractSearchControls(props: {
|
||||||
return (
|
return (
|
||||||
<Col className={clsx('bg-base-200 top-0 z-20 gap-3 pb-3', className)}>
|
<Col className={clsx('bg-base-200 top-0 z-20 gap-3 pb-3', className)}>
|
||||||
<Row className="gap-1 sm:gap-2">
|
<Row className="gap-1 sm:gap-2">
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => updateQuery(e.target.value)}
|
onChange={(e) => updateQuery(e.target.value)}
|
||||||
onBlur={trackCallback('search', { query: query })}
|
onBlur={trackCallback('search', { query: query })}
|
||||||
placeholder={'Search'}
|
placeholder="Search"
|
||||||
className="input input-bordered w-full"
|
className="w-full"
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
/>
|
/>
|
||||||
{!isMobile && !query && (
|
{!isMobile && !query && (
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
|
|
||||||
import { Contract, MAX_DESCRIPTION_LENGTH } from 'common/contract'
|
import { Contract, MAX_DESCRIPTION_LENGTH } from 'common/contract'
|
||||||
import { exhibitExts } from 'common/util/parse'
|
import { exhibitExts } from 'common/util/parse'
|
||||||
import { useAdmin } from 'web/hooks/use-admin'
|
import { useAdmin } from 'web/hooks/use-admin'
|
||||||
|
@ -15,6 +13,7 @@ import { Button } from '../button'
|
||||||
import { Spacer } from '../layout/spacer'
|
import { Spacer } from '../layout/spacer'
|
||||||
import { Editor, Content as ContentType } from '@tiptap/react'
|
import { Editor, Content as ContentType } from '@tiptap/react'
|
||||||
import { insertContent } from '../editor/utils'
|
import { insertContent } from '../editor/utils'
|
||||||
|
import { ExpandingInput } from '../expanding-input'
|
||||||
|
|
||||||
export function ContractDescription(props: {
|
export function ContractDescription(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -138,8 +137,8 @@ function EditQuestion(props: {
|
||||||
|
|
||||||
return editing ? (
|
return editing ? (
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
className="textarea textarea-bordered mb-1 h-24 w-full resize-none"
|
className="mb-1 h-24 w-full"
|
||||||
rows={2}
|
rows={2}
|
||||||
value={text}
|
value={text}
|
||||||
onChange={(e) => setText(e.target.value || '')}
|
onChange={(e) => setText(e.target.value || '')}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import {
|
||||||
BountiedContractBadge,
|
BountiedContractBadge,
|
||||||
BountiedContractSmallBadge,
|
BountiedContractSmallBadge,
|
||||||
} from 'web/components/contract/bountied-contract-badge'
|
} from 'web/components/contract/bountied-contract-badge'
|
||||||
|
import { Input } from '../input'
|
||||||
|
|
||||||
export type ShowTime = 'resolve-date' | 'close-date'
|
export type ShowTime = 'resolve-date' | 'close-date'
|
||||||
|
|
||||||
|
@ -445,17 +446,17 @@ function EditableCloseDate(props: {
|
||||||
<Col className="rounded bg-white px-8 pb-8">
|
<Col className="rounded bg-white px-8 pb-8">
|
||||||
<Subtitle text="Edit market close time" />
|
<Subtitle text="Edit market close time" />
|
||||||
<Row className="z-10 mr-2 mt-4 w-full shrink-0 flex-wrap items-center gap-2">
|
<Row className="z-10 mr-2 mt-4 w-full shrink-0 flex-wrap items-center gap-2">
|
||||||
<input
|
<Input
|
||||||
type="date"
|
type="date"
|
||||||
className="input input-bordered w-full shrink-0 sm:w-fit"
|
className="w-full shrink-0 sm:w-fit"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setCloseDate(e.target.value)}
|
onChange={(e) => setCloseDate(e.target.value)}
|
||||||
min={Date.now()}
|
min={Date.now()}
|
||||||
value={closeDate}
|
value={closeDate}
|
||||||
/>
|
/>
|
||||||
<input
|
<Input
|
||||||
type="time"
|
type="time"
|
||||||
className="input input-bordered w-full shrink-0 sm:w-max"
|
className="w-full shrink-0 sm:w-max"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setCloseHoursMinutes(e.target.value)}
|
onChange={(e) => setCloseHoursMinutes(e.target.value)}
|
||||||
min="00:00"
|
min="00:00"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Spacer } from 'web/components/layout/spacer'
|
import { Spacer } from 'web/components/layout/spacer'
|
||||||
import { Title } from 'web/components/title'
|
import { Title } from 'web/components/title'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
|
|
||||||
import { TextEditor, useTextEditor } from 'web/components/editor'
|
import { TextEditor, useTextEditor } from 'web/components/editor'
|
||||||
import { createPost } from 'web/lib/firebase/api'
|
import { createPost } from 'web/lib/firebase/api'
|
||||||
|
@ -10,6 +9,7 @@ import Router from 'next/router'
|
||||||
import { MAX_POST_TITLE_LENGTH } from 'common/post'
|
import { MAX_POST_TITLE_LENGTH } from 'common/post'
|
||||||
import { postPath } from 'web/lib/firebase/posts'
|
import { postPath } from 'web/lib/firebase/posts'
|
||||||
import { Group } from 'common/group'
|
import { Group } from 'common/group'
|
||||||
|
import { ExpandingInput } from './expanding-input'
|
||||||
|
|
||||||
export function CreatePost(props: { group?: Group }) {
|
export function CreatePost(props: { group?: Group }) {
|
||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
|
@ -60,9 +60,8 @@ export function CreatePost(props: { group?: Group }) {
|
||||||
Title<span className={'text-red-700'}> *</span>
|
Title<span className={'text-red-700'}> *</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
placeholder="e.g. Elon Mania Post"
|
placeholder="e.g. Elon Mania Post"
|
||||||
className="input input-bordered resize-none"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
maxLength={MAX_POST_TITLE_LENGTH}
|
maxLength={MAX_POST_TITLE_LENGTH}
|
||||||
value={title}
|
value={title}
|
||||||
|
@ -74,9 +73,8 @@ export function CreatePost(props: { group?: Group }) {
|
||||||
Subtitle<span className={'text-red-700'}> *</span>
|
Subtitle<span className={'text-red-700'}> *</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
placeholder="e.g. How Elon Musk is getting everyone's attention"
|
placeholder="e.g. How Elon Musk is getting everyone's attention"
|
||||||
className="input input-bordered resize-none"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
maxLength={MAX_POST_TITLE_LENGTH}
|
maxLength={MAX_POST_TITLE_LENGTH}
|
||||||
value={subtitle}
|
value={subtitle}
|
||||||
|
|
16
web/components/expanding-input.tsx
Normal file
16
web/components/expanding-input.tsx
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import clsx from 'clsx'
|
||||||
|
import Textarea from 'react-expanding-textarea'
|
||||||
|
|
||||||
|
/** Expanding `<textarea>` with same style as input.tsx */
|
||||||
|
export const ExpandingInput = (props: Parameters<typeof Textarea>[0]) => {
|
||||||
|
const { className, ...rest } = props
|
||||||
|
return (
|
||||||
|
<Textarea
|
||||||
|
className={clsx(
|
||||||
|
'textarea textarea-bordered resize-none text-[16px] md:text-[14px]',
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import { Avatar } from 'web/components/avatar'
|
||||||
import { Row } from 'web/components/layout/row'
|
import { Row } from 'web/components/layout/row'
|
||||||
import { searchInAny } from 'common/util/parse'
|
import { searchInAny } from 'common/util/parse'
|
||||||
import { UserLink } from 'web/components/user-link'
|
import { UserLink } from 'web/components/user-link'
|
||||||
|
import { Input } from './input'
|
||||||
|
|
||||||
export function FilterSelectUsers(props: {
|
export function FilterSelectUsers(props: {
|
||||||
setSelectedUsers: (users: User[]) => void
|
setSelectedUsers: (users: User[]) => void
|
||||||
|
@ -50,13 +51,13 @@ export function FilterSelectUsers(props: {
|
||||||
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||||
<UserIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
<UserIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||||
</div>
|
</div>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
name="user name"
|
name="user name"
|
||||||
id="user name"
|
id="user name"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
className="input input-bordered block w-full pl-10 focus:border-gray-300 "
|
className="block w-full pl-10"
|
||||||
placeholder="Austin Chen"
|
placeholder="Austin Chen"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { Title } from '../title'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { MAX_GROUP_NAME_LENGTH } from 'common/group'
|
import { MAX_GROUP_NAME_LENGTH } from 'common/group'
|
||||||
import { createGroup } from 'web/lib/firebase/api'
|
import { createGroup } from 'web/lib/firebase/api'
|
||||||
|
import { Input } from '../input'
|
||||||
|
|
||||||
export function CreateGroupButton(props: {
|
export function CreateGroupButton(props: {
|
||||||
user: User
|
user: User
|
||||||
|
@ -104,9 +105,8 @@ export function CreateGroupButton(props: {
|
||||||
|
|
||||||
<div className="form-control w-full">
|
<div className="form-control w-full">
|
||||||
<label className="mb-2 ml-1 mt-0">Group name</label>
|
<label className="mb-2 ml-1 mt-0">Group name</label>
|
||||||
<input
|
<Input
|
||||||
placeholder={'Your group name'}
|
placeholder={'Your group name'}
|
||||||
className="input input-bordered resize-none"
|
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={name}
|
value={name}
|
||||||
maxLength={MAX_GROUP_NAME_LENGTH}
|
maxLength={MAX_GROUP_NAME_LENGTH}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { Modal } from 'web/components/layout/modal'
|
||||||
import { FilterSelectUsers } from 'web/components/filter-select-users'
|
import { FilterSelectUsers } from 'web/components/filter-select-users'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { useMemberIds } from 'web/hooks/use-group'
|
import { useMemberIds } from 'web/hooks/use-group'
|
||||||
|
import { Input } from '../input'
|
||||||
|
|
||||||
export function EditGroupButton(props: { group: Group; className?: string }) {
|
export function EditGroupButton(props: { group: Group; className?: string }) {
|
||||||
const { group, className } = props
|
const { group, className } = props
|
||||||
|
@ -54,9 +55,8 @@ export function EditGroupButton(props: { group: Group; className?: string }) {
|
||||||
<span className="mb-1">Group name</span>
|
<span className="mb-1">Group name</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input
|
<Input
|
||||||
placeholder="Your group name"
|
placeholder="Your group name"
|
||||||
className="input input-bordered resize-none"
|
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={name}
|
value={name}
|
||||||
onChange={(e) => setName(e.target.value || '')}
|
onChange={(e) => setName(e.target.value || '')}
|
||||||
|
|
22
web/components/input.tsx
Normal file
22
web/components/input.tsx
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import clsx from 'clsx'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
/** Text input. Wraps html `<input>` */
|
||||||
|
export const Input = (props: JSX.IntrinsicElements['input']) => {
|
||||||
|
const { className, ...rest } = props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
className={clsx('input input-bordered text-base md:text-sm', className)}
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: replace daisyui style with our own. For reference:
|
||||||
|
|
||||||
|
james: text-lg placeholder:text-gray-400
|
||||||
|
inga: placeholder:text-greyscale-4 border-greyscale-2 rounded-md
|
||||||
|
austin: border-gray-300 text-gray-400 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm
|
||||||
|
*/
|
|
@ -7,12 +7,13 @@ import { User } from 'common/user'
|
||||||
import { ManalinkCard, ManalinkInfo } from 'web/components/manalink-card'
|
import { ManalinkCard, ManalinkInfo } from 'web/components/manalink-card'
|
||||||
import { createManalink } from 'web/lib/firebase/manalinks'
|
import { createManalink } from 'web/lib/firebase/manalinks'
|
||||||
import { Modal } from 'web/components/layout/modal'
|
import { Modal } from 'web/components/layout/modal'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { Button } from '../button'
|
import { Button } from '../button'
|
||||||
import { getManalinkUrl } from 'web/pages/links'
|
import { getManalinkUrl } from 'web/pages/links'
|
||||||
import { DuplicateIcon } from '@heroicons/react/outline'
|
import { DuplicateIcon } from '@heroicons/react/outline'
|
||||||
import { QRCode } from '../qr-code'
|
import { QRCode } from '../qr-code'
|
||||||
|
import { Input } from '../input'
|
||||||
|
import { ExpandingInput } from '../expanding-input'
|
||||||
|
|
||||||
export function CreateLinksButton(props: {
|
export function CreateLinksButton(props: {
|
||||||
user: User
|
user: User
|
||||||
|
@ -120,8 +121,8 @@ function CreateManalinkForm(props: {
|
||||||
<span className="absolute mx-3 mt-3.5 text-sm text-gray-400">
|
<span className="absolute mx-3 mt-3.5 text-sm text-gray-400">
|
||||||
M$
|
M$
|
||||||
</span>
|
</span>
|
||||||
<input
|
<Input
|
||||||
className="input input-bordered w-full pl-10"
|
className="w-full pl-10"
|
||||||
type="number"
|
type="number"
|
||||||
min="1"
|
min="1"
|
||||||
value={newManalink.amount}
|
value={newManalink.amount}
|
||||||
|
@ -136,8 +137,7 @@ function CreateManalinkForm(props: {
|
||||||
<div className="flex flex-col gap-2 md:flex-row">
|
<div className="flex flex-col gap-2 md:flex-row">
|
||||||
<div className="form-control w-full md:w-1/2">
|
<div className="form-control w-full md:w-1/2">
|
||||||
<label className="label">Uses</label>
|
<label className="label">Uses</label>
|
||||||
<input
|
<Input
|
||||||
className="input input-bordered"
|
|
||||||
type="number"
|
type="number"
|
||||||
min="1"
|
min="1"
|
||||||
value={newManalink.maxUses ?? ''}
|
value={newManalink.maxUses ?? ''}
|
||||||
|
@ -146,7 +146,7 @@ function CreateManalinkForm(props: {
|
||||||
return { ...m, maxUses: parseInt(e.target.value) }
|
return { ...m, maxUses: parseInt(e.target.value) }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
></input>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-control w-full md:w-1/2">
|
<div className="form-control w-full md:w-1/2">
|
||||||
<label className="label">Expires in</label>
|
<label className="label">Expires in</label>
|
||||||
|
@ -165,10 +165,9 @@ function CreateManalinkForm(props: {
|
||||||
</div>
|
</div>
|
||||||
<div className="form-control w-full">
|
<div className="form-control w-full">
|
||||||
<label className="label">Message</label>
|
<label className="label">Message</label>
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
placeholder={defaultMessage}
|
placeholder={defaultMessage}
|
||||||
maxLength={200}
|
maxLength={200}
|
||||||
className="input input-bordered resize-none"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
value={newManalink.message}
|
value={newManalink.message}
|
||||||
rows="3"
|
rows="3"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { ReactNode } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Spacer } from './layout/spacer'
|
import { Spacer } from './layout/spacer'
|
||||||
|
import { Input } from './input'
|
||||||
|
|
||||||
export function NumberInput(props: {
|
export function NumberInput(props: {
|
||||||
numberString: string
|
numberString: string
|
||||||
|
@ -32,9 +33,9 @@ export function NumberInput(props: {
|
||||||
return (
|
return (
|
||||||
<Col className={className}>
|
<Col className={className}>
|
||||||
<label className="input-group">
|
<label className="input-group">
|
||||||
<input
|
<Input
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'input input-bordered max-w-[200px] text-lg placeholder:text-gray-400',
|
'max-w-[200px] !text-lg',
|
||||||
error && 'input-error',
|
error && 'input-error',
|
||||||
inputClassName
|
inputClassName
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import clsx from 'clsx'
|
||||||
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
import { CPMMBinaryContract, PseudoNumericContract } from 'common/contract'
|
||||||
import { getPseudoProbability } from 'common/pseudo-numeric'
|
import { getPseudoProbability } from 'common/pseudo-numeric'
|
||||||
import { BucketInput } from './bucket-input'
|
import { BucketInput } from './bucket-input'
|
||||||
|
import { Input } from './input'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Spacer } from './layout/spacer'
|
import { Spacer } from './layout/spacer'
|
||||||
|
|
||||||
|
@ -30,11 +31,8 @@ export function ProbabilityInput(props: {
|
||||||
return (
|
return (
|
||||||
<Col className={className}>
|
<Col className={className}>
|
||||||
<label className="input-group">
|
<label className="input-group">
|
||||||
<input
|
<Input
|
||||||
className={clsx(
|
className={clsx('max-w-[200px] !text-lg', inputClassName)}
|
||||||
'input input-bordered max-w-[200px] text-lg placeholder:text-gray-400',
|
|
||||||
inputClassName
|
|
||||||
)}
|
|
||||||
type="number"
|
type="number"
|
||||||
max={99}
|
max={99}
|
||||||
min={1}
|
min={1}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Input } from './input'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
|
|
||||||
export function ProbabilitySelector(props: {
|
export function ProbabilitySelector(props: {
|
||||||
|
@ -10,10 +11,10 @@ export function ProbabilitySelector(props: {
|
||||||
return (
|
return (
|
||||||
<Row className="items-center gap-2">
|
<Row className="items-center gap-2">
|
||||||
<label className="input-group input-group-lg text-lg">
|
<label className="input-group input-group-lg text-lg">
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
value={probabilityInt}
|
value={probabilityInt}
|
||||||
className="input input-bordered input-md w-28 text-lg"
|
className="input-md w-28 !text-lg"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
min={1}
|
min={1}
|
||||||
max={99}
|
max={99}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { getUser } from 'web/lib/firebase/users'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
import { User } from 'common/user'
|
import { User } from 'common/user'
|
||||||
import { SEO } from 'web/components/SEO'
|
import { SEO } from 'web/components/SEO'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
let txns = await getAllCharityTxns()
|
let txns = await getAllCharityTxns()
|
||||||
|
@ -171,11 +172,11 @@ export default function Charity(props: {
|
||||||
/>
|
/>
|
||||||
<Spacer h={10} />
|
<Spacer h={10} />
|
||||||
|
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
onChange={(e) => debouncedQuery(e.target.value)}
|
onChange={(e) => debouncedQuery(e.target.value)}
|
||||||
placeholder="Find a charity"
|
placeholder="Find a charity"
|
||||||
className="input input-bordered mb-6 w-full"
|
className="mb-6 w-full"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<div className="grid max-w-xl grid-flow-row grid-cols-1 gap-4 self-center lg:max-w-full lg:grid-cols-2 xl:grid-cols-3">
|
<div className="grid max-w-xl grid-flow-row grid-cols-1 gap-4 self-center lg:max-w-full lg:grid-cols-2 xl:grid-cols-3">
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
urlParamStore,
|
urlParamStore,
|
||||||
} from 'web/hooks/use-persistent-state'
|
} from 'web/hooks/use-persistent-state'
|
||||||
import { PAST_BETS } from 'common/user'
|
import { PAST_BETS } from 'common/user'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
|
||||||
const MAX_CONTRACTS_RENDERED = 100
|
const MAX_CONTRACTS_RENDERED = 100
|
||||||
|
|
||||||
|
@ -88,12 +89,12 @@ export default function ContractSearchFirestore(props: {
|
||||||
<div>
|
<div>
|
||||||
{/* Show a search input next to a sort dropdown */}
|
{/* Show a search input next to a sort dropdown */}
|
||||||
<div className="mt-2 mb-8 flex justify-between gap-2">
|
<div className="mt-2 mb-8 flex justify-between gap-2">
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
placeholder="Search markets"
|
placeholder="Search markets"
|
||||||
className="input input-bordered w-full"
|
className="w-full"
|
||||||
/>
|
/>
|
||||||
<select
|
<select
|
||||||
className="select select-bordered"
|
className="select select-bordered"
|
||||||
|
|
|
@ -2,7 +2,6 @@ import router, { useRouter } from 'next/router'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import { Spacer } from 'web/components/layout/spacer'
|
import { Spacer } from 'web/components/layout/spacer'
|
||||||
import { getUserAndPrivateUser } from 'web/lib/firebase/users'
|
import { getUserAndPrivateUser } from 'web/lib/firebase/users'
|
||||||
import { Contract, contractPath } from 'web/lib/firebase/contracts'
|
import { Contract, contractPath } from 'web/lib/firebase/contracts'
|
||||||
|
@ -39,6 +38,8 @@ import { SiteLink } from 'web/components/site-link'
|
||||||
import { Button } from 'web/components/button'
|
import { Button } from 'web/components/button'
|
||||||
import { AddFundsModal } from 'web/components/add-funds-modal'
|
import { AddFundsModal } from 'web/components/add-funds-modal'
|
||||||
import ShortToggle from 'web/components/widgets/short-toggle'
|
import ShortToggle from 'web/components/widgets/short-toggle'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
import { ExpandingInput } from 'web/components/expanding-input'
|
||||||
|
|
||||||
export const getServerSideProps = redirectIfLoggedOut('/', async (_, creds) => {
|
export const getServerSideProps = redirectIfLoggedOut('/', async (_, creds) => {
|
||||||
return { props: { auth: await getUserAndPrivateUser(creds.uid) } }
|
return { props: { auth: await getUserAndPrivateUser(creds.uid) } }
|
||||||
|
@ -104,9 +105,8 @@ export default function Create(props: { auth: { user: User } }) {
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
placeholder="e.g. Will the Democrats win the 2024 US presidential election?"
|
placeholder="e.g. Will the Democrats win the 2024 US presidential election?"
|
||||||
className="input input-bordered resize-none"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
maxLength={MAX_QUESTION_LENGTH}
|
maxLength={MAX_QUESTION_LENGTH}
|
||||||
value={question}
|
value={question}
|
||||||
|
@ -329,9 +329,9 @@ export function NewContract(props: {
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<Row className="gap-2">
|
<Row className="gap-2">
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
className="input input-bordered w-32"
|
className="w-32"
|
||||||
placeholder="LOW"
|
placeholder="LOW"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setMinString(e.target.value)}
|
onChange={(e) => setMinString(e.target.value)}
|
||||||
|
@ -340,9 +340,9 @@ export function NewContract(props: {
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={minString ?? ''}
|
value={minString ?? ''}
|
||||||
/>
|
/>
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
className="input input-bordered w-32"
|
className="w-32"
|
||||||
placeholder="HIGH"
|
placeholder="HIGH"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setMaxString(e.target.value)}
|
onChange={(e) => setMaxString(e.target.value)}
|
||||||
|
@ -374,9 +374,8 @@ export function NewContract(props: {
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<Row className="gap-2">
|
<Row className="gap-2">
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
className="input input-bordered"
|
|
||||||
placeholder="Initial value"
|
placeholder="Initial value"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setInitialValueString(e.target.value)}
|
onChange={(e) => setInitialValueString(e.target.value)}
|
||||||
|
@ -446,19 +445,17 @@ export function NewContract(props: {
|
||||||
className={'col-span-4 sm:col-span-2'}
|
className={'col-span-4 sm:col-span-2'}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row className="mt-4 gap-2">
|
||||||
<input
|
<Input
|
||||||
type={'date'}
|
type={'date'}
|
||||||
className="input input-bordered mt-4"
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setCloseDate(e.target.value)}
|
onChange={(e) => setCloseDate(e.target.value)}
|
||||||
min={Math.round(Date.now() / MINUTE_MS) * MINUTE_MS}
|
min={Math.round(Date.now() / MINUTE_MS) * MINUTE_MS}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={closeDate}
|
value={closeDate}
|
||||||
/>
|
/>
|
||||||
<input
|
<Input
|
||||||
type={'time'}
|
type={'time'}
|
||||||
className="input input-bordered mt-4 ml-2"
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setCloseHoursMinutes(e.target.value)}
|
onChange={(e) => setCloseHoursMinutes(e.target.value)}
|
||||||
min={'00:00'}
|
min={'00:00'}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import Router from 'next/router'
|
import Router from 'next/router'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
|
|
||||||
import { DateDoc } from 'common/post'
|
import { DateDoc } from 'common/post'
|
||||||
import { useTextEditor, TextEditor } from 'web/components/editor'
|
import { useTextEditor, TextEditor } from 'web/components/editor'
|
||||||
import { Page } from 'web/components/page'
|
import { Page } from 'web/components/page'
|
||||||
|
@ -17,6 +15,8 @@ import { MAX_QUESTION_LENGTH } from 'common/contract'
|
||||||
import { NoSEO } from 'web/components/NoSEO'
|
import { NoSEO } from 'web/components/NoSEO'
|
||||||
import ShortToggle from 'web/components/widgets/short-toggle'
|
import ShortToggle from 'web/components/widgets/short-toggle'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from 'common/util/object'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
import { ExpandingInput } from 'web/components/expanding-input'
|
||||||
|
|
||||||
export default function CreateDateDocPage() {
|
export default function CreateDateDocPage() {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
@ -94,9 +94,8 @@ export default function CreateDateDocPage() {
|
||||||
<Col className="gap-8">
|
<Col className="gap-8">
|
||||||
<Col className="max-w-[160px] justify-start gap-4">
|
<Col className="max-w-[160px] justify-start gap-4">
|
||||||
<div className="">Birthday</div>
|
<div className="">Birthday</div>
|
||||||
<input
|
<Input
|
||||||
type={'date'}
|
type={'date'}
|
||||||
className="input input-bordered"
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) => setBirthday(e.target.value)}
|
onChange={(e) => setBirthday(e.target.value)}
|
||||||
max={Math.round(Date.now() / MINUTE_MS) * MINUTE_MS}
|
max={Math.round(Date.now() / MINUTE_MS) * MINUTE_MS}
|
||||||
|
@ -122,8 +121,7 @@ export default function CreateDateDocPage() {
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Col className="gap-2">
|
<Col className="gap-2">
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
className="input input-bordered resize-none"
|
|
||||||
maxLength={MAX_QUESTION_LENGTH}
|
maxLength={MAX_QUESTION_LENGTH}
|
||||||
value={question}
|
value={question}
|
||||||
onChange={(e) => setQuestion(e.target.value || '')}
|
onChange={(e) => setQuestion(e.target.value || '')}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { SEO } from 'web/components/SEO'
|
||||||
import { GetServerSideProps } from 'next'
|
import { GetServerSideProps } from 'next'
|
||||||
import { authenticateOnServer } from 'web/lib/firebase/server-auth'
|
import { authenticateOnServer } from 'web/lib/firebase/server-auth'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||||
const creds = await authenticateOnServer(ctx)
|
const creds = await authenticateOnServer(ctx)
|
||||||
|
@ -106,12 +107,12 @@ export default function Groups(props: {
|
||||||
title: 'All',
|
title: 'All',
|
||||||
content: (
|
content: (
|
||||||
<Col>
|
<Col>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
onChange={(e) => debouncedQuery(e.target.value)}
|
onChange={(e) => debouncedQuery(e.target.value)}
|
||||||
placeholder="Search groups"
|
placeholder="Search groups"
|
||||||
value={query}
|
value={query}
|
||||||
className="input input-bordered mb-4 w-full"
|
className="mb-4 w-full"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex flex-wrap justify-center gap-4">
|
<div className="flex flex-wrap justify-center gap-4">
|
||||||
|
@ -134,12 +135,12 @@ export default function Groups(props: {
|
||||||
title: 'My Groups',
|
title: 'My Groups',
|
||||||
content: (
|
content: (
|
||||||
<Col>
|
<Col>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => debouncedQuery(e.target.value)}
|
onChange={(e) => debouncedQuery(e.target.value)}
|
||||||
placeholder="Search your groups"
|
placeholder="Search your groups"
|
||||||
className="input input-bordered mb-4 w-full"
|
className="mb-4 w-full"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex flex-wrap justify-center gap-4">
|
<div className="flex flex-wrap justify-center gap-4">
|
||||||
|
|
|
@ -48,6 +48,7 @@ import {
|
||||||
} from 'web/hooks/use-contracts'
|
} from 'web/hooks/use-contracts'
|
||||||
import { ProfitBadge } from 'web/components/profit-badge'
|
import { ProfitBadge } from 'web/components/profit-badge'
|
||||||
import { LoadingIndicator } from 'web/components/loading-indicator'
|
import { LoadingIndicator } from 'web/components/loading-indicator'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
@ -99,10 +100,10 @@ export default function Home() {
|
||||||
<Row
|
<Row
|
||||||
className={'mb-2 w-full items-center justify-between gap-4 sm:gap-8'}
|
className={'mb-2 w-full items-center justify-between gap-4 sm:gap-8'}
|
||||||
>
|
>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={'Search'}
|
placeholder={'Search'}
|
||||||
className="input input-bordered w-full"
|
className="w-full"
|
||||||
onClick={() => Router.push('/search')}
|
onClick={() => Router.push('/search')}
|
||||||
/>
|
/>
|
||||||
<CustomizeButton justIcon />
|
<CustomizeButton justIcon />
|
||||||
|
|
|
@ -3,8 +3,9 @@ import { PrivateUser, User } from 'common/user'
|
||||||
import { cleanDisplayName, cleanUsername } from 'common/util/clean-username'
|
import { cleanDisplayName, cleanUsername } from 'common/util/clean-username'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import Textarea from 'react-expanding-textarea'
|
|
||||||
import { ConfirmationButton } from 'web/components/confirmation-button'
|
import { ConfirmationButton } from 'web/components/confirmation-button'
|
||||||
|
import { ExpandingInput } from 'web/components/expanding-input'
|
||||||
|
import { Input } from 'web/components/input'
|
||||||
import { Col } from 'web/components/layout/col'
|
import { Col } from 'web/components/layout/col'
|
||||||
import { Row } from 'web/components/layout/row'
|
import { Row } from 'web/components/layout/row'
|
||||||
import { Page } from 'web/components/page'
|
import { Page } from 'web/components/page'
|
||||||
|
@ -43,16 +44,15 @@ function EditUserField(props: {
|
||||||
<label className="label">{label}</label>
|
<label className="label">{label}</label>
|
||||||
|
|
||||||
{field === 'bio' ? (
|
{field === 'bio' ? (
|
||||||
<Textarea
|
<ExpandingInput
|
||||||
className="textarea textarea-bordered w-full resize-none"
|
className="w-full"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => setValue(e.target.value)}
|
onChange={(e) => setValue(e.target.value)}
|
||||||
onBlur={updateField}
|
onBlur={updateField}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
className="input input-bordered"
|
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => setValue(e.target.value || '')}
|
onChange={(e) => setValue(e.target.value || '')}
|
||||||
onBlur={updateField}
|
onBlur={updateField}
|
||||||
|
@ -152,10 +152,9 @@ export default function ProfilePage(props: {
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="label">Display name</label>
|
<label className="label">Display name</label>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Display name"
|
placeholder="Display name"
|
||||||
className="input input-bordered"
|
|
||||||
value={name}
|
value={name}
|
||||||
onChange={(e) => setName(e.target.value || '')}
|
onChange={(e) => setName(e.target.value || '')}
|
||||||
onBlur={updateDisplayName}
|
onBlur={updateDisplayName}
|
||||||
|
@ -164,10 +163,9 @@ export default function ProfilePage(props: {
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="label">Username</label>
|
<label className="label">Username</label>
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
className="input input-bordered"
|
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value || '')}
|
onChange={(e) => setUsername(e.target.value || '')}
|
||||||
onBlur={updateUsername}
|
onBlur={updateUsername}
|
||||||
|
@ -199,10 +197,9 @@ export default function ProfilePage(props: {
|
||||||
<div>
|
<div>
|
||||||
<label className="label">API key</label>
|
<label className="label">API key</label>
|
||||||
<div className="input-group w-full">
|
<div className="input-group w-full">
|
||||||
<input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Click refresh to generate key"
|
placeholder="Click refresh to generate key"
|
||||||
className="input input-bordered w-full"
|
|
||||||
value={apiKey}
|
value={apiKey}
|
||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user