Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pubsweet
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giorgio Sironi
pubsweet
Commits
a7b5a1bf
Commit
a7b5a1bf
authored
7 years ago
by
Aanand Prasad
Browse files
Options
Downloads
Patches
Plain Diff
style: add 'inline' prop to TextField
parent
3dd4a0f8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/ui/src/atoms/Label.js
+1
-3
1 addition, 3 deletions
packages/ui/src/atoms/Label.js
packages/ui/src/molecules/TextField.js
+14
-2
14 additions, 2 deletions
packages/ui/src/molecules/TextField.js
packages/ui/src/molecules/TextField.md
+13
-0
13 additions, 0 deletions
packages/ui/src/molecules/TextField.md
with
28 additions
and
5 deletions
packages/ui/src/atoms/Label.js
+
1
−
3
View file @
a7b5a1bf
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
const
Label
=
styled
.
label
`
const
Label
=
styled
.
label
``
margin-right: 10px;
`
export
default
Label
export
default
Label
This diff is collapsed.
Click to expand it.
packages/ui/src/molecules/TextField.js
+
14
−
2
View file @
a7b5a1bf
...
@@ -7,10 +7,21 @@ import Input from '../atoms/Input'
...
@@ -7,10 +7,21 @@ import Input from '../atoms/Input'
const
Root
=
styled
.
div
`
const
Root
=
styled
.
div
`
--font-local: var(--font-reviewer);
--font-local: var(--font-reviewer);
align-items: center;
display: flex;
display: flex;
flex-direction:
${
props
=>
(
props
.
inline
?
'
row
'
:
'
column
'
)}
;
align-items:
${
props
=>
(
props
.
inline
?
'
center
'
:
'
normal
'
)}
;
justify-items:
${
props
=>
(
props
.
inline
?
'
bottom
'
:
'
auto
'
)}
;
max-width: 200px;
margin-top: 0;
margin-bottom: 20px;
font-size: 1em;
font-size: 1em;
line-height: 1.8;
line-height: 1.8;
${
Input
}
{
margin-left:
${
props
=>
(
props
.
inline
?
'
1em
'
:
''
)}
;
}
`
`
const
TextField
=
({
const
TextField
=
({
...
@@ -23,8 +34,9 @@ const TextField = ({
...
@@ -23,8 +34,9 @@ const TextField = ({
onBlur
,
onBlur
,
onChange
,
onChange
,
readonly
,
readonly
,
inline
,
})
=>
(
})
=>
(
<
Root
>
<
Root
inline
=
{
inline
}
>
{
label
&&
<
Label
>
{
label
}
<
/Label>
}
{
label
&&
<
Label
>
{
label
}
<
/Label>
}
<
Input
<
Input
name
=
{
name
}
name
=
{
name
}
...
...
This diff is collapsed.
Click to expand it.
packages/ui/src/molecules/TextField.md
+
13
−
0
View file @
a7b5a1bf
...
@@ -20,3 +20,16 @@ initialState = { value: '' }
...
@@ -20,3 +20,16 @@ initialState = { value: '' }
onChange
=
{
event
=>
setState
({
value
:
event
.
target
.
value
})}
onChange
=
{
event
=>
setState
({
value
:
event
.
target
.
value
})}
/>
/>
```
```
By default, the label is above the input. Pass
`inline`
to put them side-by-side.
```
js
initialState
=
{
value
:
''
}
;
<
TextField
inline
label
=
"
Foo
"
value
=
{
state
.
value
}
placeholder
=
"
so you can write some in here
"
onChange
=
{
event
=>
setState
({
value
:
event
.
target
.
value
})}
/>
```
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment