Skip to content

Commit

Permalink
fix(ui): updated input fields to match new color scheme (#3323)
Browse files Browse the repository at this point in the history
* Updated input fields to match new color scheme

Added small input text fields and fixed coloring

* Added tailwind changes to viewers file
  • Loading branch information
bradenjmorley authored Apr 28, 2023
1 parent 075008c commit fe7fa6e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 8 deletions.
10 changes: 9 additions & 1 deletion platform/ui/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ import Label from '../Label';
import classnames from 'classnames';

const baseInputClasses =
'shadow transition duration-300 appearance-none border border-primary-main hover:border-gray-500 focus:border-gray-500 focus:outline-none rounded w-full py-2 px-3 text-sm text-white leading-tight focus:outline-none';
'shadow transition duration-300 appearance-none border border-inputfield-main focus:border-inputfield-focus focus:outline-none disabled:border-inputfield-disabled rounded w-full py-2 px-3 text-sm text-white placeholder-inputfield-placeholder leading-tight';

const transparentClasses = {
true: 'bg-transparent',
false: 'bg-black',
};

const smallInputClasses = {
true: 'input-small',
false: ''
}

const Input = ({
id,
label,
containerClassName = '',
labelClassName = '',
className = '',
transparent = false,
smallInput = false,
type = 'text',
value,
onChange,
Expand All @@ -39,6 +45,7 @@ const Input = ({
className,
baseInputClasses,
transparentClasses[transparent],
smallInputClasses[smallInput],
{ 'cursor-not-allowed': disabled }
)}
disabled={disabled}
Expand All @@ -63,6 +70,7 @@ Input.propTypes = {
labelClassName: PropTypes.string,
className: PropTypes.string,
transparent: PropTypes.bool,
smallInput: PropTypes.bool,
type: PropTypes.string,
value: PropTypes.any,
onChange: PropTypes.func,
Expand Down
13 changes: 13 additions & 0 deletions platform/ui/src/components/Input/__stories__/input.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ Input is a component that renders the Inputs.
</Story>
</Canvas>

### Small Input

<Canvas>
<Story
name="Small"
args={{
smallInput: true,
}}
>
{InputTemplate.bind({})}
</Story>
</Canvas>

### Classnames

You can change the appearance of the container and label.
Expand Down
6 changes: 5 additions & 1 deletion platform/ui/src/components/InputNumber/InputNumber.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ input[type='text'] {
-webkit-appearance: none;
}

input[type='text']:focus {
.input-number:focus {
border: none;
outline: none;
}
Expand All @@ -15,3 +15,7 @@ input[type='text']:focus {
.up-arrowsize svg path {
fill: #726f7e;
}

.input-small {
height: 26px;
}
7 changes: 3 additions & 4 deletions platform/ui/src/components/InputNumber/InputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ const InputNumber: React.FC<{

return (
<div
className={`flex items-center bg-black border-2 px-1 overflow-hidden justify-center border-secondary-light rounded-md ${
sizesClasses[size]
} ${className ? className : ''}`}
className={`flex items-center bg-black border-2 px-1 overflow-hidden justify-center border-secondary-light rounded-md ${sizesClasses[size]
} ${className ? className : ''}`}
>
<div className="flex">
<input
type="text"
value={numberValue}
onChange={handleChange}
className={`bg-black text-white text-[12px] w-full text-center`}
className={`bg-black text-white text-[12px] w-full text-center input-number`}
/>

<div className="up-arrowsize flex flex-col items-center justify-around">
Expand Down
4 changes: 2 additions & 2 deletions platform/ui/src/components/InputText/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const InputText = ({
>
<Input
id={id}
className="border-primary-main mt-2 bg-black"
className="mt-2"
type="text"
containerClassName="mr-2"
value={value}
Expand All @@ -36,7 +36,7 @@ const InputText = ({
InputText.defaultProps = {
value: '',
isSortable: false,
onLabelClick: () => {},
onLabelClick: () => { },
sortDirection: 'none',
};

Expand Down
7 changes: 7 additions & 0 deletions platform/ui/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ module.exports = {
active: '#348cfd',
},

inputfield: {
main: '#3a3f99',
disabled: '#2b166b',
focus: '#5acce6',
placeholder: '#39383f'
},

secondary: {
light: '#3a3f99',
main: '#2b166b',
Expand Down
7 changes: 7 additions & 0 deletions platform/viewer/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ module.exports = {
active: '#348cfd',
},

inputfield: {
main: '#3a3f99',
disabled: '#2b166b',
focus: '#5acce6',
placeholder: '#39383f'
},

secondary: {
light: '#3a3f99',
main: '#2b166b',
Expand Down

0 comments on commit fe7fa6e

Please sign in to comment.