-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add blue focus on text inputs #8343
Changes from all commits
f165495
c66f354
49d1a27
ef9fbe5
46b6742
7504631
3da6919
3523c26
fadb4a5
1509a8a
476442a
43b7335
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import { | |
useRef, | ||
useState, | ||
} from 'react'; | ||
import { IconComponent, IconEye, IconEyeOff } from 'twenty-ui'; | ||
import { IconComponent, IconEye, IconEyeOff, RGBA } from 'twenty-ui'; | ||
import { useCombinedRefs } from '~/hooks/useCombinedRefs'; | ||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly'; | ||
|
||
|
@@ -33,6 +33,7 @@ const StyledInputContainer = styled.div` | |
display: flex; | ||
flex-direction: row; | ||
width: 100%; | ||
position: relative; | ||
`; | ||
|
||
const StyledInput = styled.input< | ||
|
@@ -42,12 +43,7 @@ const StyledInput = styled.input< | |
border: 1px solid | ||
${({ theme, error }) => | ||
error ? theme.border.color.danger : theme.border.color.medium}; | ||
border-bottom-left-radius: ${({ theme, LeftIcon }) => | ||
!LeftIcon && theme.border.radius.sm}; | ||
border-right: none; | ||
border-left: ${({ LeftIcon }) => LeftIcon && 'none'}; | ||
border-top-left-radius: ${({ theme, LeftIcon }) => | ||
!LeftIcon && theme.border.radius.sm}; | ||
border-radius: ${({ theme }) => theme.border.radius.sm}; | ||
box-sizing: border-box; | ||
color: ${({ theme }) => theme.font.color.primary}; | ||
display: flex; | ||
|
@@ -57,6 +53,8 @@ const StyledInput = styled.input< | |
height: 32px; | ||
outline: none; | ||
padding: ${({ theme }) => theme.spacing(2)}; | ||
padding-left: ${({ theme, LeftIcon }) => | ||
LeftIcon ? `calc(${theme.spacing(4)} + 16px)` : theme.spacing(2)}; | ||
width: 100%; | ||
Comment on lines
+56
to
58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: The left padding calculation assumes a fixed icon size of 16px. Consider using theme.icon.size.md instead for consistency. |
||
|
||
&::placeholder, | ||
|
@@ -69,6 +67,13 @@ const StyledInput = styled.input< | |
&:disabled { | ||
color: ${({ theme }) => theme.font.color.tertiary}; | ||
} | ||
|
||
&:focus { | ||
${({ theme }) => { | ||
return `box-shadow: 0px 0px 0px 3px ${RGBA(theme.color.blue, 0.1)}; | ||
border-color: ${theme.color.blue};`; | ||
}}; | ||
} | ||
Comment on lines
+71
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: The focus state uses a semi-transparent blue shadow (0.1 opacity) which may be too subtle for accessibility. Consider increasing the opacity for better visibility. |
||
`; | ||
|
||
const StyledErrorHelper = styled.div` | ||
|
@@ -79,30 +84,27 @@ const StyledErrorHelper = styled.div` | |
|
||
const StyledLeftIconContainer = styled.div` | ||
align-items: center; | ||
background-color: ${({ theme }) => theme.background.transparent.lighter}; | ||
border: 1px solid ${({ theme }) => theme.border.color.medium}; | ||
border-bottom-left-radius: ${({ theme }) => theme.border.radius.sm}; | ||
border-right: none; | ||
border-top-left-radius: ${({ theme }) => theme.border.radius.sm}; | ||
display: flex; | ||
justify-content: center; | ||
padding-left: ${({ theme }) => theme.spacing(2)}; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
margin: auto 0; | ||
`; | ||
|
||
const StyledTrailingIconContainer = styled.div< | ||
Pick<TextInputV2ComponentProps, 'error'> | ||
>` | ||
align-items: center; | ||
background-color: ${({ theme }) => theme.background.transparent.lighter}; | ||
border: 1px solid | ||
${({ theme, error }) => | ||
error ? theme.border.color.danger : theme.border.color.medium}; | ||
border-bottom-right-radius: ${({ theme }) => theme.border.radius.sm}; | ||
border-left: none; | ||
border-top-right-radius: ${({ theme }) => theme.border.radius.sm}; | ||
display: flex; | ||
justify-content: center; | ||
padding-right: ${({ theme }) => theme.spacing(1)}; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
right: 0; | ||
margin: auto 0; | ||
`; | ||
|
||
const StyledTrailingIcon = styled.div` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { act } from 'react-dom/test-utils'; | ||
import { expect } from '@storybook/test'; | ||
import { renderHook } from '@testing-library/react'; | ||
import { act } from 'react-dom/test-utils'; | ||
import { RecoilRoot } from 'recoil'; | ||
|
||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown'; | ||
|
@@ -57,7 +57,7 @@ describe('useDropdown', () => { | |
wrapper: Wrapper, | ||
}); | ||
|
||
expect(result.current.dropdownWidth).toBe(160); | ||
expect(result.current.dropdownWidth).toBe(200); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: default width changed from 160 to 200 - ensure this change is intentional and coordinated with the dropdownWidthComponentState default value |
||
await act(async () => { | ||
result.current.setDropdownWidth(220); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ import { Key } from 'ts-key-enum'; | |
import { IconChevronLeft } from 'twenty-ui'; | ||
|
||
import { IconPicker } from '@/ui/input/components/IconPicker'; | ||
import { TextInputV2 } from '@/ui/input/components/TextInputV2'; | ||
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader'; | ||
import { DropdownMenuInput } from '@/ui/layout/dropdown/components/DropdownMenuInput'; | ||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; | ||
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; | ||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; | ||
|
@@ -79,11 +79,11 @@ export const ViewPickerContentEditMode = () => { | |
disableBlur | ||
onClose={() => setHotkeyScope(ViewsHotkeyScope.ListDropdown)} | ||
/> | ||
<DropdownMenuInput | ||
<TextInputV2 | ||
value={viewPickerInputName} | ||
onChange={(event) => { | ||
onChange={(value) => { | ||
setViewPickerIsDirty(true); | ||
setViewPickerInputName(event.target.value); | ||
setViewPickerInputName(value); | ||
}} | ||
autoFocus | ||
/> | ||
Comment on lines
+82
to
89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: TextInputV2 may need a placeholder prop to match previous DropdownMenuInput behavior |
||
|
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.
logic: This side effect should be moved to a useEffect hook to avoid potential render loop issues