feat(instances): status icon cross, cns tags color

This commit is contained in:
johnytiago 2018-05-09 12:25:04 +01:00 committed by Sérgio Ramos
parent b00baa7028
commit 062ff0ba67
9 changed files with 67 additions and 18 deletions

View File

@ -4898,6 +4898,7 @@ exports[`renders <Cns mutating /> without throwing 1`] = `
-webkit-box-align: center; -webkit-box-align: center;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
background: rgba(66,134,244,0.1);
border: 0.0625rem solid rgb(45,56,132); border: 0.0625rem solid rgb(45,56,132);
} }
@ -5358,6 +5359,7 @@ exports[`renders <Cns mutating /> without throwing 1`] = `
> >
<li <li
className="c39" className="c39"
fill="rgba(66, 134, 244, 0.1)"
> >
serbice serbice
</li> </li>
@ -5367,6 +5369,7 @@ exports[`renders <Cns mutating /> without throwing 1`] = `
> >
<li <li
className="c39" className="c39"
fill="rgba(66, 134, 244, 0.1)"
> >
dssasda dssasda
</li> </li>
@ -5376,6 +5379,7 @@ exports[`renders <Cns mutating /> without throwing 1`] = `
> >
<li <li
className="c39" className="c39"
fill="rgba(66, 134, 244, 0.1)"
> >
dsasd dsasd
</li> </li>
@ -7477,6 +7481,7 @@ exports[`renders <Cns services /> without throwing 1`] = `
-webkit-box-align: center; -webkit-box-align: center;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
background: rgba(66,134,244,0.1);
border: 0.0625rem solid rgb(45,56,132); border: 0.0625rem solid rgb(45,56,132);
} }
@ -7701,6 +7706,7 @@ exports[`renders <Cns services /> without throwing 1`] = `
> >
<li <li
className="c26" className="c26"
fill="rgba(66, 134, 244, 0.1)"
> >
serbice serbice
<svg <svg
@ -7729,6 +7735,7 @@ exports[`renders <Cns services /> without throwing 1`] = `
> >
<li <li
className="c26" className="c26"
fill="rgba(66, 134, 244, 0.1)"
> >
dssasda dssasda
<svg <svg
@ -7757,6 +7764,7 @@ exports[`renders <Cns services /> without throwing 1`] = `
> >
<li <li
className="c26" className="c26"
fill="rgba(66, 134, 244, 0.1)"
> >
dsasd dsasd
<svg <svg

View File

@ -6299,6 +6299,7 @@ Array [
> >
<li <li
className="c34" className="c34"
fill={null}
name="wat" name="wat"
style={ style={
Object { Object {
@ -7893,6 +7894,7 @@ Array [
> >
<li <li
className="c34" className="c34"
fill={null}
name="wat" name="wat"
style={ style={
Object { Object {

View File

@ -6288,6 +6288,7 @@ exports[`renders <Tags tags /> without throwing 1`] = `
> >
<li <li
className="c22" className="c22"
fill={null}
onClick={undefined} onClick={undefined}
> >
name1: value1 name1: value1
@ -6302,6 +6303,7 @@ exports[`renders <Tags tags /> without throwing 1`] = `
> >
<li <li
className="c22" className="c22"
fill={null}
onClick={undefined} onClick={undefined}
> >
name2: value2 name2: value2
@ -6316,6 +6318,7 @@ exports[`renders <Tags tags /> without throwing 1`] = `
> >
<li <li
className="c22" className="c22"
fill={null}
onClick={undefined} onClick={undefined}
> >
name3: value3 name3: value3

View File

@ -3,21 +3,27 @@ import Flex, { FlexItem } from 'styled-flex-component';
import { Margin } from 'styled-components-spacing'; import { Margin } from 'styled-components-spacing';
import { H3, TickIcon } from 'joyent-ui-toolkit'; import { H3, TickIcon } from 'joyent-ui-toolkit';
import { StatusIcon } from 'joyent-ui-resource-step'; import { StatusIcon, ErrorIcon } from 'joyent-ui-resource-step';
export const Preview = ({ enabled }) => ( export const Preview = ({ enabled }) => (
<Flex> <Flex>
<FlexItem> <FlexItem>
<Margin right={2}> <Margin right={2}>
<StatusIcon {enabled ? (
fill="green" <StatusIcon
border="greenDark" fill="green"
Icon={() => <TickIcon fill="white" />} border="greenDark"
/> Icon={() => <TickIcon fill="white" />}
/>
) : (
<ErrorIcon noLabel inverted />
)}
</Margin> </Margin>
</FlexItem> </FlexItem>
<FlexItem> <FlexItem>
<H3>{enabled ? 'Firewall enabled' : 'Firewall not enabled'}</H3> <H3>
{enabled ? 'Firewall rules are enabled' : 'Firewall rules are disabled'}
</H3>
</FlexItem> </FlexItem>
</Flex> </Flex>
); );

View File

@ -39,7 +39,7 @@ const TagList = styled(BaseTagList)`
const Tag = ({ name, value, onRemoveClick }) => ( const Tag = ({ name, value, onRemoveClick }) => (
<Margin right={1} bottom={1} key={`${name}-${value}`}> <Margin right={1} bottom={1} key={`${name}-${value}`}>
<TagItem fill="grey" onRemoveClick={onRemoveClick}> <TagItem iconFill="grey" onRemoveClick={onRemoveClick}>
{name ? `${name}: ${value}` : value} {name ? `${name}: ${value}` : value}
</TagItem> </TagItem>
</Margin> </Margin>

View File

@ -57,10 +57,22 @@ export const Saved = ({ inverted, children }) => {
); );
}; };
export const Error = ({ children }) => ( export const Error = ({ inverted = false, noLabel = false, children }) => {
<StatusIcon border="redDark" Icon={() => <CloseIcon fill="redDark" />}> const fill = inverted ? 'red' : 'white';
<Margin right="1"> const iconFill = inverted ? 'white' : 'redDark';
<Label color="redDark">Error</Label> console.log(inverted, fill, iconFill);
</Margin>
</StatusIcon> return (
); <StatusIcon
border="redDark"
fill={fill}
Icon={() => <CloseIcon fill={iconFill} />}
>
{noLabel ? null : (
<Margin right="1">
<Label color="redDark">Error</Label>
</Margin>
)}
</StatusIcon>
);
};

View File

@ -1279,6 +1279,7 @@ Array [
> >
<li <li
className="c18" className="c18"
fill={null}
name="wat" name="wat"
style={ style={
Object { Object {
@ -3377,6 +3378,7 @@ Array [
> >
<li <li
className="c14" className="c14"
fill={null}
name="wat" name="wat"
style={ style={
Object { Object {
@ -4799,6 +4801,7 @@ Array [
> >
<li <li
className="c18" className="c18"
fill={null}
name="wat" name="wat"
style={ style={
Object { Object {

View File

@ -203,6 +203,7 @@ const CnsHostnames = ({
{services.map(value => ( {services.map(value => (
<TagItem <TagItem
active active
fill={'rgba(66, 134, 244, 0.1)'}
key={value} key={value}
onRemoveClick={ onRemoveClick={
onRemoveService && (() => onRemoveService(value)) onRemoveService && (() => onRemoveService(value))

View File

@ -32,6 +32,10 @@ const Tag = styled.li`
background: ${props => props.theme.disabled}; background: ${props => props.theme.disabled};
`}; `};
${is('fill')`
background: ${props => props.fill};
`};
${is('error')` ${is('error')`
border: ${remcalc(1)} solid ${props => props.theme.red}; border: ${remcalc(1)} solid ${props => props.theme.red};
`}; `};
@ -46,13 +50,23 @@ const Tag = styled.li`
`; `;
export default withTheme( export default withTheme(
({ theme, children, active, onRemoveClick, fill = null, ...rest }) => ( ({
theme,
children,
active,
onRemoveClick,
fill = null,
iconFill = null,
...rest
}) => (
<Container> <Container>
<Tag active={active} {...rest}> <Tag fill={fill} active={active} {...rest}>
{children} {children}
{onRemoveClick ? ( {onRemoveClick ? (
<CloseIcon <CloseIcon
fill={fill ? fill : active ? theme.primaryActive : theme.text} fill={
iconFill ? iconFill : active ? theme.primaryActive : theme.text
}
disabled disabled
onClick={onRemoveClick} onClick={onRemoveClick}
/> />