Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Feat: Revamp input field #218

Merged
merged 14 commits into from
Jan 5, 2022
12 changes: 12 additions & 0 deletions src/assets/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,15 @@
@apply bg-gradient-to-tr from-vice-start to-vice-stop;
}
}

/* Classes to remove number spinners from inputs of type number */
/* Chrome, Safari, Edge, Opera */
.remove-number-spinner::-webkit-outer-spin-button,
.remove-number-spinner::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
.remove-number-spinner {
-moz-appearance: textfield;
}
2 changes: 1 addition & 1 deletion src/components/address-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useForm } from "react-hook-form"
import { Flex, Text } from "rebass"
import { isEmpty } from "lodash"
import Select from "../select"
import Input from "../input"
import Input from "../molecules/input"
import { countries } from "../../utils/countries"

const inputStyle = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/availability-duration/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react"

import { Flex, Text, Box } from "rebass"
import Input from "../input"
import Input from "../molecules/input"
import Typography from "../typography"
import styled from "@emotion/styled"
import { parse } from "iso8601-duration"
Expand Down
2 changes: 1 addition & 1 deletion src/components/date-picker/date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDatePicker from "react-datepicker"
import "react-datepicker/dist/react-datepicker.css"
import { Box, Flex } from "rebass"
import Button from "../button"
import InputField from "../input"
import InputField from "../molecules/input"
import moment from "moment"
import styled from "@emotion/styled"

Expand Down
2 changes: 1 addition & 1 deletion src/components/filter-dropdown-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Box, Text, Flex } from "rebass"
import Select from "../select"
import { DateFilters } from "../../utils/filters"
import { addHours, atMidnight, dateToUnixTimestamp } from "../../utils/time"
import InputField from "../input"
import InputField from "../molecules/input"
import ReactDatePicker from "react-datepicker"
import DatePicker from "../date-picker/date-picker"
import moment from "moment"
Expand Down
7 changes: 7 additions & 0 deletions src/components/fundamentals/icons/icon-type.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type IconProps = {
color?: string
size?: string | number
attributes?: React.SVGAttributes<SVGElement>
}

export default IconProps
29 changes: 29 additions & 0 deletions src/components/fundamentals/icons/minus-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react"
import IconProps from "./icon-type"

const MinusIcon: React.FC<IconProps> = ({
size = "24px",
color = "currentColor",
attributes,
}) => {
return (
<svg
width={size}
height={size}
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...attributes}
>
<path
d="M3.33301 8H12.6663"
stroke={color}
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
)
}

export default MinusIcon
36 changes: 36 additions & 0 deletions src/components/fundamentals/icons/plus-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from "react"
import IconProps from "./icon-type"

const PlusIcon: React.FC<IconProps> = ({
size = "24px",
color = "currentColor",
attributes,
}) => {
return (
<svg
width={size}
height={size}
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...attributes}
>
<path
d="M8 3.33331V12.6666"
stroke={color}
stroke-width="1.33333"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M3.33301 8H12.6663"
stroke={color}
stroke-width="1.33333"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
)
}

export default PlusIcon
29 changes: 29 additions & 0 deletions src/components/fundamentals/input-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react"
import { MouseEventHandler } from "react"

type InputContainerProps = {
key?: string
props?: React.HTMLAttributes<HTMLDivElement>
onClick?: MouseEventHandler<HTMLDivElement>
}

const InputContainer: React.FC<InputContainerProps> = ({
key,
props,
onClick,
children,
}) => {
return (
<div
tabIndex={-1}
className="bg-grey-5 inter-base-regular w-full p-3 flex h-18 flex-col cursor-text border border-grey-20 focus-within:shadow-input focus-within:border-violet-60 rounded-base my-4"
onClick={onClick}
key={key}
{...props}
>
{children}
</div>
)
}

export default InputContainer
32 changes: 32 additions & 0 deletions src/components/fundamentals/input-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react"
import InfoTooltip from "../info-tooltip"

type InputHeaderProps = {
label: string
required?: boolean
withTooltip?: boolean
tooltipText?: string
tooltipProps?: any
}

const InputHeader: React.FC<InputHeaderProps> = ({
label,
required = false,
withTooltip = false,
tooltipText,
tooltipProps,
}) => {
return (
<div className="w-full flex inter-small-semibold text-grey-50 items-center">
{label}
{required && <div className="text-rose-50 "> *</div>}
{withTooltip ? (
<div className="ml-2">
<InfoTooltip tooltipText={tooltipText} {...tooltipProps} />
</div>
) : null}
</div>
)
}

export default InputHeader
135 changes: 0 additions & 135 deletions src/components/input/index.js

This file was deleted.

Loading