Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
b4072735
Commit
b4072735
authored
Sep 19, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style pin input
parent
80180014
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
4 deletions
+53
-4
.eslintrc.js
.eslintrc.js
+1
-1
PinInput.ts
theme/components/PinInput.ts
+34
-0
index.ts
theme/components/index.ts
+2
-0
PinInput.tsx
ui/shared/chakra/PinInput.tsx
+10
-0
AuthModalFieldEmail.tsx
ui/snippets/auth/fields/AuthModalFieldEmail.tsx
+1
-0
AuthModalFieldOtpCode.tsx
ui/snippets/auth/fields/AuthModalFieldOtpCode.tsx
+5
-3
No files found.
.eslintrc.js
View file @
b4072735
...
@@ -7,7 +7,7 @@ const RESTRICTED_MODULES = {
...
@@ -7,7 +7,7 @@ const RESTRICTED_MODULES = {
{
name
:
'
playwright/TestApp
'
,
message
:
'
Please use render() fixture from test() function of playwright/lib module
'
},
{
name
:
'
playwright/TestApp
'
,
message
:
'
Please use render() fixture from test() function of playwright/lib module
'
},
{
{
name
:
'
@chakra-ui/react
'
,
name
:
'
@chakra-ui/react
'
,
importNames
:
[
'
Popover
'
,
'
Menu
'
,
'
useToast
'
],
importNames
:
[
'
Popover
'
,
'
Menu
'
,
'
PinInput
'
,
'
useToast
'
],
message
:
'
Please use corresponding component or hook from ui/shared/chakra component instead
'
,
message
:
'
Please use corresponding component or hook from ui/shared/chakra component instead
'
,
},
},
{
{
...
...
theme/components/PinInput.ts
0 → 100644
View file @
b4072735
import
{
defineStyle
,
defineStyleConfig
}
from
'
@chakra-ui/styled-system
'
;
import
getOutlinedFieldStyles
from
'
../utils/getOutlinedFieldStyles
'
;
const
baseStyle
=
defineStyle
({
textAlign
:
'
center
'
,
bgColor
:
'
dialog_bg
'
,
});
const
sizes
=
{
md
:
defineStyle
({
fontSize
:
'
md
'
,
w
:
10
,
h
:
10
,
borderRadius
:
'
md
'
,
}),
};
const
variants
=
{
outline
:
defineStyle
(
(
props
)
=>
getOutlinedFieldStyles
(
props
),
),
};
const
PinInput
=
defineStyleConfig
({
baseStyle
,
sizes
,
variants
,
defaultProps
:
{
size
:
'
md
'
,
},
});
export
default
PinInput
;
theme/components/index.ts
View file @
b4072735
...
@@ -10,6 +10,7 @@ import Input from './Input';
...
@@ -10,6 +10,7 @@ import Input from './Input';
import
Link
from
'
./Link
'
;
import
Link
from
'
./Link
'
;
import
Menu
from
'
./Menu
'
;
import
Menu
from
'
./Menu
'
;
import
Modal
from
'
./Modal
'
;
import
Modal
from
'
./Modal
'
;
import
PinInput
from
'
./PinInput
'
;
import
Popover
from
'
./Popover
'
;
import
Popover
from
'
./Popover
'
;
import
Radio
from
'
./Radio
'
;
import
Radio
from
'
./Radio
'
;
import
Select
from
'
./Select
'
;
import
Select
from
'
./Select
'
;
...
@@ -36,6 +37,7 @@ const components = {
...
@@ -36,6 +37,7 @@ const components = {
Link
,
Link
,
Menu
,
Menu
,
Modal
,
Modal
,
PinInput
,
Popover
,
Popover
,
Radio
,
Radio
,
Select
,
Select
,
...
...
ui/shared/chakra/PinInput.tsx
0 → 100644
View file @
b4072735
import
type
{
PinInputProps
,
StyleProps
}
from
'
@chakra-ui/react
'
;
// eslint-disable-next-line no-restricted-imports
import
{
PinInput
as
PinInputBase
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
const
PinInput
=
(
props
:
PinInputProps
&
{
bgColor
?:
StyleProps
[
'
bgColor
'
]
})
=>
{
return
<
PinInputBase
{
...
props
}
/>;
};
export
default
React
.
memo
(
PinInput
);
ui/snippets/auth/fields/AuthModalFieldEmail.tsx
View file @
b4072735
...
@@ -29,6 +29,7 @@ const AuthModalFieldEmail = ({ className }: Props) => {
...
@@ -29,6 +29,7 @@ const AuthModalFieldEmail = ({ className }: Props) => {
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
isDisabled
}
isDisabled=
{
isDisabled
}
autoComplete=
"off"
autoComplete=
"off"
bgColor=
"dialog_bg"
/>
/>
<
InputPlaceholder
text=
"Email"
error=
{
fieldState
.
error
}
/>
<
InputPlaceholder
text=
"Email"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
...
...
ui/snippets/auth/fields/AuthModalFieldOtpCode.tsx
View file @
b4072735
import
{
HStack
,
PinInput
,
PinInput
Field
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
PinInputField
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
useController
,
useFormContext
}
from
'
react-hook-form
'
;
import
{
useController
,
useFormContext
}
from
'
react-hook-form
'
;
import
type
{
OtpCodeFormFields
}
from
'
../types
'
;
import
type
{
OtpCodeFormFields
}
from
'
../types
'
;
import
PinInput
from
'
ui/shared/chakra/PinInput
'
;
const
CODE_LENGTH
=
6
;
const
CODE_LENGTH
=
6
;
const
AuthModalFieldOtpCode
=
()
=>
{
const
AuthModalFieldOtpCode
=
()
=>
{
...
@@ -19,9 +21,9 @@ const AuthModalFieldOtpCode = () => {
...
@@ -19,9 +21,9 @@ const AuthModalFieldOtpCode = () => {
return
(
return
(
<>
<>
<
HStack
>
<
HStack
>
<
PinInput
otp
placeholder=
""
{
...
field
}
isDisabled=
{
isDisabled
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
>
<
PinInput
otp
placeholder=
""
{
...
field
}
isDisabled=
{
isDisabled
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
bgColor=
"dialog_bg"
>
{
Array
.
from
({
length
:
CODE_LENGTH
}).
map
((
_
,
index
)
=>
(
{
Array
.
from
({
length
:
CODE_LENGTH
}).
map
((
_
,
index
)
=>
(
<
PinInputField
key=
{
index
}
borderRadius=
"base"
borderWidth=
"2px"
/>
<
PinInputField
key=
{
index
}
borderRadius=
"base"
borderWidth=
"2px"
bgColor=
"dialog_bg"
/>
))
}
))
}
</
PinInput
>
</
PinInput
>
</
HStack
>
</
HStack
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment