Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
cd50da3d
Unverified
Commit
cd50da3d
authored
Mar 17, 2020
by
Alex Khomenko
Committed by
GitHub
Mar 17, 2020
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grafana-UI: Add invalid state to Forms.Textarea (#22775)
parent
b930966f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
24 deletions
+30
-24
packages/grafana-ui/src/components/Forms/Form.story.tsx
+6
-0
packages/grafana-ui/src/components/Forms/Input/Input.tsx
+23
-24
packages/grafana-ui/src/components/Forms/TextArea/TextArea.tsx
+1
-0
No files found.
packages/grafana-ui/src/components/Forms/Form.story.tsx
View file @
cd50da3d
...
...
@@ -16,6 +16,7 @@ import Forms from './index';
import
mdx
from
'./Form.mdx'
;
import
{
ValidateResult
}
from
'react-hook-form'
;
import
{
boolean
}
from
'@storybook/addon-knobs'
;
import
{
TextArea
}
from
'./TextArea/TextArea'
;
export
default
{
title
:
'Forms/Test forms'
,
...
...
@@ -50,6 +51,7 @@ interface FormDTO {
switch
:
boolean
;
radio
:
string
;
select
:
string
;
text
:
string
;
nested
:
{
path
:
string
;
};
...
...
@@ -88,6 +90,10 @@ const renderForm = (defaultValues?: Partial<FormDTO>) => (
<
Input
name=
"nested.path"
placeholder=
"Nested path"
size=
"md"
ref=
{
register
}
/>
</
Field
>
<
Field
label=
"Textarea"
invalid=
{
!!
errors
.
text
}
error=
"Text is required"
>
<
TextArea
name=
"text"
placeholder=
"Long text"
size=
"md"
ref=
{
register
({
required
:
true
})
}
/>
</
Field
>
<
Field
label=
"Checkbox"
invalid=
{
!!
errors
.
checkbox
}
error=
"We need your consent"
>
<
Checkbox
name=
"checkbox"
label=
"Do you consent?"
ref=
{
register
({
required
:
true
})
}
/>
</
Field
>
...
...
packages/grafana-ui/src/components/Forms/Input/Input.tsx
View file @
cd50da3d
...
...
@@ -50,7 +50,7 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false }: StyleDe
`
;
return
{
// Wraps inputWraper and addons
// Wraps inputWrap
p
er and addons
wrapper
:
cx
(
css
`
label: input-wrapper;
...
...
@@ -149,37 +149,36 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false }: StyleDe
color:
${
colors
.
formInputDisabledText
}
;
`
,
addon
:
css
`
label: input-addon;
display: flex;
justify-content: center;
align-items: center;
flex-grow: 0;
flex-shrink: 0;
position: relative;
label: input-addon;
display: flex;
justify-content: center;
align-items: center;
flex-grow: 0;
flex-shrink: 0;
position: relative;
&:first-child {
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
> :last-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
> :last-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
}
&:last-child {
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
> :first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
> :first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
> *:focus {
/* we want anything that has focus and is an addon to be above input */
z-index: 2;
}
}
`
,
}
> *:focus {
/* we want anything that has focus and is an addon to be above input */
z-index: 2;
}
`
,
prefix
:
cx
(
prefixSuffix
,
css
`
...
...
packages/grafana-ui/src/components/Forms/TextArea/TextArea.tsx
View file @
cd50da3d
...
...
@@ -32,6 +32,7 @@ const getTextAreaStyle = stylesFactory((theme: GrafanaTheme, invalid = false) =>
border-radius:
${
theme
.
border
.
radius
.
sm
}
;
padding:
${
theme
.
spacing
.
formSpacingBase
/
4
}
px
${
theme
.
spacing
.
formSpacingBase
}
px;
width: 100%;
border-color:
${
invalid
?
theme
.
colors
.
redBase
:
theme
.
colors
.
formInputBorder
}
;
`
),
};
...
...
Kornkitt Poolsup
@Doratong24
mentioned in commit
9d605bdd
Mar 05, 2021
mentioned in commit
9d605bdd
mentioned in commit 9d605bdd040e59ec23711771c9ab8ff54672f0b3
Toggle commit list
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