fix(my-joy-beta): display tags number when expanded

This commit is contained in:
Sara Vieira 2018-01-31 12:15:07 +00:00 committed by Sérgio Ramos
parent 2e36b850ca
commit 60128aef4a
5 changed files with 133 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -394,6 +394,42 @@ Array [
</p> </p>
</div> </div>
</div> </div>
</div>,
.c1 {
color: rgba(73,73,73,1);
font-weight: normal;
line-height: 1.625rem;
font-size: 1.3125rem;
margin: 0;
}
.c1 + p,
.c1 + small,
.c1 + h1,
.c1 + h2,
.c1 + label,
.c1 + h3,
.c1 + h4,
.c1 + h5,
.c1 + div,
.c1 + span {
margin-top: 1.5rem;
}
.c0 {
margin-bottom: 1.5rem;
}
<div
className="c0"
>
<h3
className="c1"
>
0
Tag
s
</h3>
</div>, </div>,
.c1 { .c1 {
margin: 0; margin: 0;
@ -1900,6 +1936,42 @@ Array [
</p> </p>
</div> </div>
</div> </div>
</div>,
.c1 {
color: rgba(73,73,73,1);
font-weight: normal;
line-height: 1.625rem;
font-size: 1.3125rem;
margin: 0;
}
.c1 + p,
.c1 + small,
.c1 + h1,
.c1 + h2,
.c1 + label,
.c1 + h3,
.c1 + h4,
.c1 + h5,
.c1 + div,
.c1 + span {
margin-top: 1.5rem;
}
.c0 {
margin-bottom: 1.5rem;
}
<div
className="c0"
>
<h3
className="c1"
>
0
Tag
s
</h3>
</div>, </div>,
.c1 { .c1 {
margin: 0; margin: 0;
@ -2539,6 +2611,42 @@ Array [
</p> </p>
</div> </div>
</div> </div>
</div>,
.c1 {
color: rgba(73,73,73,1);
font-weight: normal;
line-height: 1.625rem;
font-size: 1.3125rem;
margin: 0;
}
.c1 + p,
.c1 + small,
.c1 + h1,
.c1 + h2,
.c1 + label,
.c1 + h3,
.c1 + h4,
.c1 + h5,
.c1 + div,
.c1 + span {
margin-top: 1.5rem;
}
.c0 {
margin-bottom: 1.5rem;
}
<div
className="c0"
>
<h3
className="c1"
>
0
Tag
s
</h3>
</div>, </div>,
.c1 { .c1 {
margin: 0; margin: 0;

View File

@ -34,54 +34,48 @@ export const Tags = ({
handleEdit handleEdit
}) => ( }) => (
<Fragment> <Fragment>
<Title <Title id={step} onClick={!expanded && !proceeded && handleEdit} icon={<TagsIcon />}>
id={step}
onClick={!expanded && !proceeded && handleEdit}
icon={<TagsIcon />}
>
Tags Tags
</Title> </Title>
{expanded ? ( {expanded ? (
<Description> <Description>
Tags can be used to identify your instances, group multiple instances Tags can be used to identify your instances, group multiple instances together, define
together, define firewall and affinity rules, and more.{' '} firewall and affinity rules, and more.{' '}
<a <a
target="__blank" target="__blank"
href="https://docs.joyent.com/public-cloud/tags-metadata/tags" href="https://docs.joyent.com/public-cloud/tags-metadata/tags"
rel="noopener noreferrer" rel="noopener noreferrer">
>
Read the docs Read the docs
</a> </a>
</Description> </Description>
) : null} ) : null}
{proceeded ? (
<Margin bottom={4}>
<H3>
{tags.length} Tag{tags.length === 1 ? '' : 's'}
</H3>
</Margin>
) : null}
{proceeded || expanded ? ( {proceeded || expanded ? (
<Margin bottom={4}> <Fragment>
<TagList> <Margin bottom={4}>
{tags.map(({ name, value }, index) => ( <H3>
<Tag {tags.length} Tag{tags.length === 1 ? '' : 's'}
key={index} </H3>
name={name} </Margin>
value={value} <Margin bottom={4}>
onRemoveClick={expanded && (() => handleRemoveTag(index))} <TagList>
/> {tags.map(({ name, value }, index) => (
))} <Tag
</TagList> key={index}
</Margin> name={name}
value={value}
onRemoveClick={expanded && (() => handleRemoveTag(index))}
/>
))}
</TagList>
</Margin>
</Fragment>
) : null} ) : null}
{expanded && addOpen ? ( {expanded && addOpen ? (
<ReduxForm <ReduxForm
form={FORM_NAME_CREATE} form={FORM_NAME_CREATE}
destroyOnUnmount={false} destroyOnUnmount={false}
forceUnregisterOnUnmount={true} forceUnregisterOnUnmount={true}
onSubmit={handleAddTag} onSubmit={handleAddTag}>
>
{props => ( {props => (
<KeyValue <KeyValue
{...props} {...props}
@ -97,11 +91,7 @@ export const Tags = ({
<div> <div>
{expanded ? ( {expanded ? (
<Margin bottom={4}> <Margin bottom={4}>
<Button <Button type="button" onClick={() => handleChangeAddOpen(true)} secondary>
type="button"
onClick={() => handleChangeAddOpen(true)}
secondary
>
Add Tag Add Tag
</Button> </Button>
<Button type="button" onClick={handleNext}> <Button type="button" onClick={handleNext}>