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
5fb2a569
Commit
5fb2a569
authored
Jun 15, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add correct color styles for input and label
parent
fcf8ced4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
Form.ts
theme/components/Form.ts
+23
-12
No files found.
theme/components/Form.ts
View file @
5fb2a569
import
type
{
formAnatomy
as
parts
}
from
'
@chakra-ui/anatomy
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
{
getColor
}
from
'
@chakra-ui/theme-tools
'
;
import
{
getColor
,
mode
}
from
'
@chakra-ui/theme-tools
'
;
import
type
{
StyleFunctionProps
,
PartsStyleFunction
}
from
'
@chakra-ui/theme-tools
'
;
import
type
{
Dict
}
from
'
@chakra-ui/utils
'
;
import
getDefaultFormColors
from
'
../utils/getDefaultFormColors
'
;
const
activeLabelStyles
=
{
const
getActiveLabelStyles
=
(
theme
:
Dict
,
fc
:
string
)
=>
(
{
fontSize
:
'
12px
'
,
lineHeight
:
'
15px
'
,
top
:
'
10px
'
,
};
color
:
getColor
(
theme
,
fc
),
})
const
activeInputStyles
=
{
const
getActiveInputStyles
=
(
theme
:
Dict
,
fc
:
string
)
=>
(
{
paddingTop
:
'
30px
'
,
paddingBottom
:
'
10px
'
,
};
borderColor
:
getColor
(
theme
,
fc
),
})
const
variantFloating
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
:
StyleFunctionProps
)
=>
{
const
{
theme
}
=
props
;
const
{
focusBorderColor
:
fc
,
errorBorderColor
:
ec
}
=
getDefaultFormColors
(
props
);
const
activeLabelStyles
=
getActiveLabelStyles
(
theme
,
fc
);
const
activeInputStyles
=
getActiveInputStyles
(
theme
,
fc
);
return
{
container
:
{
_focusWithin
:
{
...
...
@@ -29,18 +35,13 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP
...
activeInputStyles
,
},
},
'
input:not(:placeholder-shown) + label
'
:
{
...
activeLabelStyles
,
},
'
input[aria-invalid=true] + label
'
:
{
color
:
getColor
(
theme
,
ec
),
},
// label's styles
label
:
{
top
:
'
20px
'
,
left
:
0
,
zIndex
:
2
,
position
:
'
absolute
'
,
color
:
getColor
(
theme
,
fc
),
color
:
mode
(
'
gray.500
'
,
'
whiteAlpha.400
'
)(
props
),
backgroundColor
:
'
transparent
'
,
pointerEvents
:
'
none
'
,
padding
:
'
0 20px
'
,
...
...
@@ -50,12 +51,22 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP
lineHeight
:
'
20px
'
,
transitionProperty
:
'
top, font-size, line-height
'
,
},
'
input:not(:placeholder-shown) + label
'
:
{
...
activeLabelStyles
,
},
'
input[aria-invalid=true] + label
'
:
{
color
:
getColor
(
theme
,
ec
),
},
// input's styles
input
:
{
padding
:
'
20px
'
,
},
'
input:not(:placeholder-shown)
'
:
{
...
activeInputStyles
,
},
'
input[aria-invalid=true]
'
:
{
borderColor
:
getColor
(
theme
,
ec
),
},
},
}
}
...
...
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