-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🪟 🎨 🧹 Migrate Input
and TextArea
to SCSS
#16378
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0238ca6
Migrate TextArea component to SCSS and add Storybook
edmundito 710f884
Move Input styles to SCSS, add Storybook
edmundito 2cf034c
Fix Input stylelint issues
edmundito 55e3a63
Fix hover selector on Input container to avoid hovering on focus
edmundito 185a434
Fix Input focus test by using style file
edmundito bc2d9c8
Add missing & to Textarea style
edmundito 5a189bc
Fix styleint inssue in Input
edmundito 4dd83ee
Move input testid before props
edmundito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
airbyte-webapp/src/components/base/Input/Input.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
@use "../../../scss/colors"; | ||
|
||
.container { | ||
width: 100%; | ||
position: relative; | ||
background-color: colors.$grey-50; | ||
border: 1px solid colors.$grey-50; | ||
border-radius: 4px; | ||
|
||
&.light { | ||
background-color: colors.$white; | ||
} | ||
|
||
&.error { | ||
background-color: colors.$grey-100; | ||
border-color: colors.$red; | ||
} | ||
|
||
&:not(.disabled, .focused):hover { | ||
background-color: colors.$grey-100; | ||
border-color: colors.$grey-100; | ||
|
||
&.light { | ||
background-color: colors.$white; | ||
} | ||
|
||
&.error { | ||
border-color: colors.$red; | ||
} | ||
} | ||
|
||
&.focused { | ||
background-color: colors.$primaryColor12; | ||
border-color: colors.$blue; | ||
|
||
&.light { | ||
background-color: colors.$white; | ||
} | ||
} | ||
} | ||
|
||
.input { | ||
outline: none; | ||
width: 100%; | ||
padding: 7px 8px; | ||
font-size: 14px; | ||
line-height: 20px; | ||
font-weight: normal; | ||
border: none; | ||
background: none; | ||
color: colors.$dark-blue; | ||
caret-color: colors.$blue; | ||
|
||
&:not(.disabled).password { | ||
width: calc(100% - 22px); | ||
} | ||
|
||
&::placeholder { | ||
color: colors.$grey-300; | ||
} | ||
|
||
&.disabled { | ||
pointer-events: none; | ||
color: colors.$grey-400; | ||
} | ||
} | ||
|
||
button.visibilityButton { | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
display: flex; | ||
height: 100%; | ||
width: 30px; | ||
align-items: center; | ||
justify-content: center; | ||
border: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
airbyte-webapp/src/components/base/Input/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import Input from "./Input"; | ||
|
||
export default { | ||
title: "Ui/Input", | ||
component: Input, | ||
argTypes: { | ||
disabled: { control: "boolean" }, | ||
type: { control: { type: "select", options: ["text", "number", "password"] } }, | ||
}, | ||
} as ComponentMeta<typeof Input>; | ||
|
||
const Template: ComponentStory<typeof Input> = (args) => <Input {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
placeholder: "Enter text here...", | ||
}; |
52 changes: 52 additions & 0 deletions
52
airbyte-webapp/src/components/base/TextArea/TextArea.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@use "../../../scss/colors"; | ||
@use "../../../scss/variables"; | ||
|
||
.textarea { | ||
outline: none; | ||
resize: none; | ||
width: 100%; | ||
padding: 7px 8px; | ||
border-radius: 4px; | ||
font-size: 14px; | ||
line-height: 20px; | ||
font-weight: normal; | ||
border: 1px solid colors.$grey-50; | ||
background-color: colors.$grey-50; | ||
color: colors.$dark-blue; | ||
caret-color: colors.$blue; | ||
|
||
&.error { | ||
border-color: colors.$red; | ||
} | ||
|
||
&::placeholder { | ||
color: colors.$grey-300; | ||
} | ||
|
||
&:hover { | ||
background-color: colors.$grey-100; | ||
border-color: colors.$grey-100; | ||
|
||
&.light { | ||
background-color: colors.$white; | ||
} | ||
|
||
&.error { | ||
border-color: colors.$red; | ||
} | ||
} | ||
|
||
&:focus { | ||
background-color: colors.$primaryColor12; | ||
border-color: colors.$blue; | ||
|
||
&.light { | ||
background-color: colors.$white; | ||
} | ||
} | ||
|
||
&:disabled { | ||
pointer-events: none; | ||
color: colors.$grey-400; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,25 @@ | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
type TextAreaProps = { | ||
import styles from "./TextArea.module.scss"; | ||
|
||
interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { | ||
error?: boolean; | ||
light?: boolean; | ||
} & React.TextareaHTMLAttributes<HTMLTextAreaElement>; | ||
|
||
const TextArea = styled.textarea<TextAreaProps>` | ||
outline: none; | ||
resize: none; | ||
width: 100%; | ||
padding: 7px 8px; | ||
border-radius: 4px; | ||
font-size: 14px; | ||
line-height: 20px; | ||
font-weight: normal; | ||
border: 1px solid ${(props) => (props.error ? props.theme.dangerColor : props.theme.greyColor0)}; | ||
background: ${({ theme }) => theme.greyColor0}; | ||
color: ${({ theme }) => theme.textColor}; | ||
caret-color: ${({ theme }) => theme.primaryColor}; | ||
|
||
&::placeholder { | ||
color: ${({ theme }) => theme.greyColor40}; | ||
} | ||
|
||
&:hover { | ||
background: ${({ theme, light }) => (light ? theme.whiteColor : theme.greyColor20)}; | ||
border-color: ${(props) => (props.error ? props.theme.dangerColor : props.theme.greyColor20)}; | ||
} | ||
|
||
&:focus { | ||
background: ${({ theme, light }) => (light ? theme.whiteColor : theme.primaryColor12)}; | ||
border-color: ${({ theme }) => theme.primaryColor}; | ||
} | ||
|
||
&:disabled { | ||
pointer-events: none; | ||
color: ${({ theme }) => theme.greyColor55}; | ||
} | ||
`; | ||
} | ||
|
||
export { TextArea }; | ||
export type { TextAreaProps }; | ||
export const TextArea: React.FC<TextAreaProps> = ({ error, light, children, className, ...textAreaProps }) => ( | ||
<textarea | ||
{...textAreaProps} | ||
className={classNames( | ||
styles.textarea, | ||
{ | ||
[styles.error]: error, | ||
[styles.light]: light, | ||
}, | ||
className | ||
)} | ||
> | ||
{children} | ||
</textarea> | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing button looks like it's going to be fun