Skip to content

Commit

Permalink
👍 added required Tag to Field component when its required
Browse files Browse the repository at this point in the history
  • Loading branch information
wacky committed Jun 21, 2019
1 parent 749c9f1 commit a6d1370
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/Field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled, { css } from 'styled-components'
import { InjectedProps, withTheme } from '../../hocs/withTheme'

import { NumberInput, PasswordInput, Props as InputProps, TextInput } from '../Input'
import { Tag } from '../Tag'

interface Props {
label: string
Expand Down Expand Up @@ -43,7 +44,14 @@ const fieldFactory: (
<Wrapper width={widthStyle}>
<label>
<LabelHead theme={theme}>
<Title theme={theme}>{label}</Title>
<Title theme={theme}>
{label}
{required && (
<TagWrapper>
<Tag type="require">必須</Tag>
</TagWrapper>
)}
</Title>
{help && <Help theme={theme}>{help}</Help>}
</LabelHead>
{InputComponent ? (
Expand Down Expand Up @@ -108,3 +116,7 @@ const Error = styled.p`
line-height: 1.4;
`}
`

const TagWrapper = styled.span`
margin-left: 8px;
`

0 comments on commit a6d1370

Please sign in to comment.