Skip to content

Commit

Permalink
add TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
KhudaDad414 committed Oct 10, 2023
1 parent 9f91a5f commit d2ae2e3
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 104 deletions.
32 changes: 32 additions & 0 deletions apps/design-system/src/components/TextArea.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,35 @@ export const Default: Story = {
backgrounds: { default: 'light' },
},
}

export const Resizable: Story = {
args: {
...Default.args,
isResizable: true,
},
parameters: {
backgrounds: { default: 'light' },
},
};


export const Disabled: Story = {
args: {
...Default.args,
isDisabled: true,
},
parameters: {
backgrounds: { default: 'light' },
},
};

export const RowsLimit: Story = {
args: {
...Default.args,
rows: 3,
},
parameters: {
backgrounds: { default: 'light' },
},
};

73 changes: 73 additions & 0 deletions apps/design-system/src/components/TextInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { StoryObj, Meta } from '@storybook/react'

import { TextInput } from '@asyncapi/studio-ui'

const meta: Meta<typeof TextInput> = {
component: TextInput,
}

export default meta
type Story = StoryObj<typeof TextInput>

export const Default: Story = {
args: {
placeholder: "Enter some text....",
},
parameters: {
backgrounds: { default: 'light' },
},
}


export const WithInitialValue: Story = {
args: {
...Default.args,
value: 'Initial Value',
},
parameters: {
backgrounds: { default: 'light' },
},
};

export const Numeric: Story = {
args: {
...Default.args,
type: 'number',
},
parameters: {
backgrounds: { default: 'light' },
},
};


export const Email: Story = {
args: {
...Default.args,
type: 'email',
},
parameters: {
backgrounds: { default: 'light' },
},
};


export const Disabled: Story = {
args: {
...Default.args,
isDisabled: true,
},
parameters: {
backgrounds: { default: 'light' },
},
};


export const WithCustomClassName: Story = {
args: {
...Default.args,
className: 'w-full',
},
parameters: {
backgrounds: { default: 'light' },
},
};
76 changes: 4 additions & 72 deletions apps/design-system/src/styles/tailwind.output.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/* 2 */
border-style: solid;
/* 2 */
border-color: #e5e7eb;
border-color: #e2e8f0;
/* 2 */
}

Expand All @@ -42,7 +42,7 @@ html {
/* 3 */
tab-size: 4;
/* 3 */
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* 4 */
-webkit-font-feature-settings: normal;
font-feature-settings: normal;
Expand Down Expand Up @@ -369,15 +369,15 @@ textarea {
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
opacity: 1;
/* 1 */
color: #9ca3af;
color: #94a3b8;
/* 2 */
}

input::placeholder,
textarea::placeholder {
opacity: 1;
/* 1 */
color: #9ca3af;
color: #94a3b8;
/* 2 */
}

Expand Down Expand Up @@ -583,71 +583,3 @@ video {
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
}

.mx-3 {
margin-left: 0.75rem;
margin-right: 0.75rem;
}

.my-3 {
margin-top: 0.75rem;
margin-bottom: 0.75rem;
}

.flex {
display: flex;
}

.h-6 {
height: 1.5rem;
}

.w-6 {
width: 1.5rem;
}

.grow {
flex-grow: 1;
}

.flex-col {
flex-direction: column;
}

.gap-3 {
gap: 0.75rem;
}

.rounded {
border-radius: 0.25rem;
}

.bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
}

.bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
}

.px-4 {
padding-left: 1rem;
padding-right: 1rem;
}

.text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}

.text-gray-500 {
--tw-text-opacity: 1;
color: rgb(107 114 128 / var(--tw-text-opacity));
}

.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
12 changes: 5 additions & 7 deletions apps/design-system/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @type {import('tailwindcss').Config} */
const sharedConfig = require('tailwind-config/tailwind.config.js');

module.exports = {
content: ["./src/**/*.tsx"],
theme: {
extend: {},
},
plugins: [],
}
content: ['./components/**/*.tsx'],
presets: [sharedConfig],
};
2 changes: 1 addition & 1 deletion packages/ui/components/Form/Inputs/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const TextArea = ({onChange, rows, name, value, isDisabled, isResizable,
disabled={isDisabled}
placeholder={placeholder}
rows={rows}
className={`bg-gray-900 rounded-md appearance-none placeholder-gray-500 placeholder:italic outline-none text-sm leading-5 text-gray-400 ${
className={`bg-gray-900 appearance-none placeholder-gray-500 placeholder:italic outline-none text-sm leading-5 text-gray-400 ${
className
} ${isDisabled && 'opacity-50'} ${!isResizable && 'resize-none'}`}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

export type InputProps = {
export type TextInputProps = {
placeholder: string
type?: 'text' | 'url'
type?: 'text' | 'number' | 'email'
value?: string
onClear?: () => void
onChange?: () => void
isDisabled?: boolean
className?: string
}

export const Input = (props: InputProps) => {
export const TextInput = (props: TextInputProps) => {
return (
<input
{...props}
Expand All @@ -20,3 +19,4 @@ export const Input = (props: InputProps) => {
/>
)
}

3 changes: 2 additions & 1 deletion packages/ui/components/Form/Inputs/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './Input'
export * from './TextInput'
export * from './TextArea'
export * from './SelectDropdown'
17 changes: 0 additions & 17 deletions packages/ui/components/Form/Labels/DescriptionWithLabel.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/ui/components/Form/Labels/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from './Label'
export * from './Description'
export * from './DescriptionWithLabel'

0 comments on commit d2ae2e3

Please sign in to comment.