feat(ui-toolkit): implement native <sup> with badge
fixes #1049 fixes #1048
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
@ -8,17 +8,7 @@ import { Row, Col } from 'react-styled-flexboxgrid';
|
|||||||
import titleCase from 'title-case';
|
import titleCase from 'title-case';
|
||||||
import includes from 'lodash.includes';
|
import includes from 'lodash.includes';
|
||||||
|
|
||||||
import {
|
import { H3, P, FormGroup, FormLabel, Toggle, H4, Select, Card } from 'joyent-ui-toolkit';
|
||||||
H3,
|
|
||||||
P,
|
|
||||||
FormGroup,
|
|
||||||
FormLabel,
|
|
||||||
Button,
|
|
||||||
Toggle,
|
|
||||||
H4,
|
|
||||||
Select,
|
|
||||||
Card
|
|
||||||
} from 'joyent-ui-toolkit';
|
|
||||||
|
|
||||||
const Version = styled(Select)`
|
const Version = styled(Select)`
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
|
@ -9,6 +9,7 @@ import bytes from 'bytes';
|
|||||||
import {
|
import {
|
||||||
H3,
|
H3,
|
||||||
H4,
|
H4,
|
||||||
|
Sup,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Button,
|
Button,
|
||||||
TableTh,
|
TableTh,
|
||||||
@ -45,22 +46,6 @@ const VerticalDivider = styled.div`
|
|||||||
box-sizing: border-box;
|
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 }) => (
|
export const Filters = ({ resetFilters }) => (
|
||||||
<Margin top={4} bottom={3}>
|
<Margin top={4} bottom={3}>
|
||||||
<H4>Filters</H4>
|
<H4>Filters</H4>
|
||||||
@ -157,7 +142,11 @@ export const Package = ({
|
|||||||
</TableTd>
|
</TableTd>
|
||||||
<TableTd right selected={selected}>
|
<TableTd right selected={selected}>
|
||||||
{bytes(disk, { decimalPlaces: 0 })}
|
{bytes(disk, { decimalPlaces: 0 })}
|
||||||
{ssd && <SuperScript>SSD</SuperScript>}
|
{ssd && (
|
||||||
|
<Margin inline left={1}>
|
||||||
|
<Sup badge>SSD</Sup>
|
||||||
|
</Margin>
|
||||||
|
)}
|
||||||
</TableTd>
|
</TableTd>
|
||||||
{hasVms && (
|
{hasVms && (
|
||||||
<TableTd right selected={selected}>
|
<TableTd right selected={selected}>
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@ -32,7 +32,6 @@ const ImageContainer = ({
|
|||||||
vms
|
vms
|
||||||
}) => (
|
}) => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{console.log({ image, vms })}
|
|
||||||
<Title
|
<Title
|
||||||
onClick={!expanded && !image.id && handleEdit}
|
onClick={!expanded && !image.id && handleEdit}
|
||||||
icon={<InstanceTypeIcon />}
|
icon={<InstanceTypeIcon />}
|
||||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -15,7 +15,7 @@ const { default: Card } = require('.');
|
|||||||
```jsx
|
```jsx
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { Margin } = require('styled-components-spacing');
|
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 { H4 } = require('../text');
|
||||||
const { Actions } = require('../icons');
|
const { Actions } = require('../icons');
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ const { Actions } = require('../icons');
|
|||||||
```jsx
|
```jsx
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { Margin } = require('styled-components-spacing');
|
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 { H4 } = require('../text');
|
||||||
const { Actions } = require('../icons');
|
const { Actions } = require('../icons');
|
||||||
|
|
||||||
@ -64,11 +64,10 @@ const { Actions } = require('../icons');
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { Padding, Margin } = require('styled-components-spacing');
|
const { Padding, Margin } = require('styled-components-spacing');
|
||||||
const { default: Flex, FlexItem } = require('styled-flex-component');
|
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 { Row, Col } = require('../grid');
|
||||||
const { H4, Strong, P } = require('../text');
|
const { Strong, P } = require('../text');
|
||||||
const { TagList, TagItem } = require('../tags');
|
const { TagList, TagItem } = require('../tags');
|
||||||
const { Actions } = require('../icons');
|
|
||||||
const { Fragment } = React;
|
const { Fragment } = React;
|
||||||
|
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@ -307,7 +306,6 @@ const { Fragment } = React;
|
|||||||
</Fragment>;
|
</Fragment>;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Select Cards
|
### Select Cards
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
@ -328,5 +326,5 @@ const { Row, Col } = require('../grid');
|
|||||||
<Col xs="3">
|
<Col xs="3">
|
||||||
<Card preview error />
|
<Card preview error />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>;
|
||||||
```
|
```
|
||||||
|
@ -8,6 +8,7 @@ export { H1, H2, H3, H4, H5, H6 } from './text/headings';
|
|||||||
export { default as P } from './text/p';
|
export { default as P } from './text/p';
|
||||||
export { default as Small } from './text/small';
|
export { default as Small } from './text/small';
|
||||||
export { default as Strong } from './text/strong';
|
export { default as Strong } from './text/strong';
|
||||||
|
export { default as Sup } from './text/sup';
|
||||||
export { default as theme } from './theme';
|
export { default as theme } from './theme';
|
||||||
export { default as Divider } from './divider';
|
export { default as Divider } from './divider';
|
||||||
export { default as Footer } from './footer';
|
export { default as Footer } from './footer';
|
||||||
|
@ -6,5 +6,6 @@ export { H1, H2, H3, H4, H5, H6 } from './headings';
|
|||||||
export { default as P } from './p';
|
export { default as P } from './p';
|
||||||
export { default as Small } from './small';
|
export { default as Small } from './small';
|
||||||
export { default as Strong } from './strong';
|
export { default as Strong } from './strong';
|
||||||
|
export { default as Sup } from './sup';
|
||||||
export { default as Label } from '../label';
|
export { default as Label } from '../label';
|
||||||
export { default as Anchor } from '../anchor';
|
export { default as Anchor } from '../anchor';
|
||||||
|
22
packages/ui-toolkit/src/text/sup.js
Normal 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};
|
||||||
|
`};
|
||||||
|
`;
|