feat(ui-toolkit): implement native <sup> with badge

fixes #1049
fixes #1048
This commit is contained in:
Sérgio Ramos 2018-01-30 00:06:48 +00:00 committed by Sérgio Ramos
parent 0ce87d3edd
commit b504d637ed
21 changed files with 36 additions and 36 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -8,17 +8,7 @@ import { Row, Col } from 'react-styled-flexboxgrid';
import titleCase from 'title-case';
import includes from 'lodash.includes';
import {
H3,
P,
FormGroup,
FormLabel,
Button,
Toggle,
H4,
Select,
Card
} from 'joyent-ui-toolkit';
import { H3, P, FormGroup, FormLabel, Toggle, H4, Select, Card } from 'joyent-ui-toolkit';
const Version = styled(Select)`
min-width: 100%;

View File

@ -9,6 +9,7 @@ import bytes from 'bytes';
import {
H3,
H4,
Sup,
FormGroup,
Button,
TableTh,
@ -45,22 +46,6 @@ const VerticalDivider = styled.div`
box-sizing: border-box;
`;
const SuperScript = styled.div`
background: ${props => props.theme.primary};
border-radius: ${remcalc(3)};
font-weight: 600;
line-height: normal;
font-size: ${remcalc(8)};
color: ${props => props.theme.white};
display: inline-flex;
align-items: center;
justify-content: center;
padding: ${remcalc(3)};
position: absolute;
margin-top: ${remcalc(-8)};
margin-left: ${remcalc(6)};
`;
export const Filters = ({ resetFilters }) => (
<Margin top={4} bottom={3}>
<H4>Filters</H4>
@ -157,7 +142,11 @@ export const Package = ({
</TableTd>
<TableTd right selected={selected}>
{bytes(disk, { decimalPlaces: 0 })}
{ssd && <SuperScript>SSD</SuperScript>}
{ssd && (
<Margin inline left={1}>
<Sup badge>SSD</Sup>
</Margin>
)}
</TableTd>
{hasVms && (
<TableTd right selected={selected}>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -32,7 +32,6 @@ const ImageContainer = ({
vms
}) => (
<Fragment>
{console.log({ image, vms })}
<Title
onClick={!expanded && !image.id && handleEdit}
icon={<InstanceTypeIcon />}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -15,7 +15,7 @@ const { default: Card } = require('.');
```jsx
const React = require('react');
const { Margin } = require('styled-components-spacing');
const { default: Card, Header, HeaderBox, HeaderMeta, Outlet } = require('.');
const { default: Card, Header, HeaderBox, HeaderMeta } = require('.');
const { H4 } = require('../text');
const { Actions } = require('../icons');
@ -39,7 +39,7 @@ const { Actions } = require('../icons');
```jsx
const React = require('react');
const { Margin } = require('styled-components-spacing');
const { default: Card, Header, HeaderBox, HeaderMeta, Outlet } = require('.');
const { default: Card, Header, HeaderBox, HeaderMeta } = require('.');
const { H4 } = require('../text');
const { Actions } = require('../icons');
@ -64,11 +64,10 @@ const { Actions } = require('../icons');
const React = require('react');
const { Padding, Margin } = require('styled-components-spacing');
const { default: Flex, FlexItem } = require('styled-flex-component');
const { default: Card, Header, HeaderBox, HeaderMeta, Outlet } = require('.');
const { default: Card } = require('.');
const { Row, Col } = require('../grid');
const { H4, Strong, P } = require('../text');
const { Strong, P } = require('../text');
const { TagList, TagItem } = require('../tags');
const { Actions } = require('../icons');
const { Fragment } = React;
<Fragment>
@ -307,7 +306,6 @@ const { Fragment } = React;
</Fragment>;
```
### Select Cards
```jsx
@ -328,5 +326,5 @@ const { Row, Col } = require('../grid');
<Col xs="3">
<Card preview error />
</Col>
</Row>
</Row>;
```

View File

@ -8,6 +8,7 @@ export { H1, H2, H3, H4, H5, H6 } from './text/headings';
export { default as P } from './text/p';
export { default as Small } from './text/small';
export { default as Strong } from './text/strong';
export { default as Sup } from './text/sup';
export { default as theme } from './theme';
export { default as Divider } from './divider';
export { default as Footer } from './footer';

View File

@ -6,5 +6,6 @@ export { H1, H2, H3, H4, H5, H6 } from './headings';
export { default as P } from './p';
export { default as Small } from './small';
export { default as Strong } from './strong';
export { default as Sup } from './sup';
export { default as Label } from '../label';
export { default as Anchor } from '../anchor';

View File

@ -0,0 +1,22 @@
import styled from 'styled-components';
import remcalc from 'remcalc';
import is from 'styled-is';
export default styled.sup`
position: relative;
bottom: 0.5em;
border-radius: ${remcalc(3)};
font-weight: ${props => props.theme.font.weight.semibold};
line-height: normal;
font-size: ${remcalc(8)};
color: ${props => props.theme.primary};
display: inline-flex;
align-items: center;
justify-content: center;
${is('badge')`
padding: ${remcalc(2)} ${remcalc(3)};
background: ${props => props.theme.primary};
color: ${props => props.theme.white};
`};
`;