Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Pills(Added Outlined Pills) + Added Text Variants #59

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/core/Pills/OutlinedPills/OutlinedPills.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { storiesOf } from '@storybook/react';
import React from 'react';
import { ThemedBackground } from '../../../utils/storybook';
import { OutlinedPills } from '../../Pills';

storiesOf('Pills/Outlined Pills', module)
// Litmus Portal
.add('Litmus Portal', () => (
<ThemedBackground platform="litmus-portal">
<OutlinedPills label="Outlined Pill" />
</ThemedBackground>
))

// Kubera Chaos
.add('Kubera Chaos', () => (
<ThemedBackground platform="kubera-chaos">
<OutlinedPills label="Outlined Pill" />
</ThemedBackground>
))

// Kubera Propel
.add('Kubera Propel', () => (
<ThemedBackground platform="kubera-propel">
<OutlinedPills label="Outlined Pill" />
</ThemedBackground>
))

// Kubera Portal
.add('Kubera Portal', () => (
<ThemedBackground platform="kubera-portal">
<OutlinedPills label="Outlined Pill" />
</ThemedBackground>
))

// Kubera Core
.add('Kubera Core', () => (
<ThemedBackground platform="kubera-core">
<OutlinedPills label="Outlined Pill" />
</ThemedBackground>
));
15 changes: 15 additions & 0 deletions src/core/Pills/OutlinedPills/OutlinedPills.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Chip } from '@material-ui/core';
import React from 'react';
import { ChipBaseProps } from '../base';
import { useStyles } from './style';

interface OutlinedPillsProps extends ChipBaseProps {
label: string;
}

const OutlinedPills: React.FC<OutlinedPillsProps> = ({ label }) => {
const classes = useStyles();

return <Chip label={label} className={classes.root} />;
};
export { OutlinedPills };
16 changes: 16 additions & 0 deletions src/core/Pills/OutlinedPills/__tests__/OutlinedPills.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { render } from '@testing-library/react';
import React from 'react';
import { KuberaThemeProvider } from '../../../../theme';
import { OutlinedPills } from '../../../Pills';

describe('Basic Pills Component', () => {
it('Renders', () => {
const { getByText } = render(
<KuberaThemeProvider platform="kubera-chaos">
<OutlinedPills label="Outlined Pill" />
</KuberaThemeProvider>
);

expect(getByText('Outlined Pill')).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions src/core/Pills/OutlinedPills/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './OutlinedPills';
17 changes: 17 additions & 0 deletions src/core/Pills/OutlinedPills/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { makeStyles, Theme } from '@material-ui/core';

const useStyles = makeStyles((theme: Theme) => ({
root: {
padding: theme.spacing(0.45, 1.5),
borderRadius: '0.1875rem',
fontSize: '0.625rem',
fontWeight: 500,
textTransform: 'none',
color: theme.palette.primary.light,
height: 'auto',
background: 'transparent',
border: `0.025rem solid ${theme.palette.primary.dark}`,
},
}));

export { useStyles };
1 change: 1 addition & 0 deletions src/core/Pills/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './BasicPills';
export * from './LightPills';
export * from './OutlinedPills';
35 changes: 20 additions & 15 deletions src/core/Text/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,49 @@ storiesOf('Text/HeaderText', module)
// Litmus Portal
.add('Litmus Portal', () => (
<ThemedBackground platform="litmus-portal" row>
<Header>Header Text</Header>
<Header variant="bold">Header Text</Header>
<Header color={'green'}>Header Text</Header>
<Header>Header Text Primary</Header>
<Header variant="bold">Header Text Bold</Header>
<Header variant="small">Header Text Small</Header>
<Header color={'green'}>Header Text Colored</Header>
</ThemedBackground>
))

// Kubera Chaos
.add('Kubera Chaos', () => (
<ThemedBackground platform="kubera-chaos" row>
<Header>Header Text</Header>
<Header variant="bold">Header Text</Header>
<Header color={'green'}>Header Text</Header>
<Header>Header Text Primary</Header>
<Header variant="bold">Header Text Bold</Header>
<Header variant="small">Header Text Small</Header>
<Header color={'green'}>Header Text Colored</Header>
</ThemedBackground>
))

// Kubera Propel
.add('Kubera Propel', () => (
<ThemedBackground platform="kubera-propel" row>
<Header>Header Text</Header>
<Header variant="bold">Header Text</Header>
<Header color={'green'}>Header Text</Header>
<Header>Header Text Primary</Header>
<Header variant="bold">Header Text Bold</Header>
<Header variant="small">Header Text Small</Header>
<Header color={'green'}>Header Text Colored</Header>
</ThemedBackground>
))

// Kubera Portal
.add('Kubera Portal', () => (
<ThemedBackground platform="kubera-portal" row>
<Header>Header Text</Header>
<Header variant="bold">Header Text</Header>
<Header color={'green'}>Header Text</Header>
<Header>Header Text Primary</Header>
<Header variant="bold">Header Text Bold</Header>
<Header variant="small">Header Text Small</Header>
<Header color={'green'}>Header Text Colored</Header>
</ThemedBackground>
))

// Kubera Core
.add('Kubera Core', () => (
<ThemedBackground platform="kubera-core" row>
<Header>Header Text</Header>
<Header variant="bold">Header Text</Header>
<Header color={'green'}>Header Text</Header>
<Header>Header Text Primary</Header>
<Header variant="bold">Header Text Bold</Header>
<Header variant="small">Header Text Small</Header>
<Header color={'green'}>Header Text Colored</Header>
</ThemedBackground>
));
8 changes: 4 additions & 4 deletions src/core/Text/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { TypographyBaseProps, Variant } from '../base';
import { useStyles } from './styles';
import { TypographyBaseProps } from '../base';
import Typography from '@material-ui/core/Typography';

type Variant = 'bold' | undefined;

interface HeaderProps extends TypographyBaseProps {
variant?: Variant;
Expand All @@ -17,6 +15,8 @@ const Header: React.FC<HeaderProps> = ({ color, variant, children }) => {
switch (variant) {
case 'bold':
return classes.bold;
case 'small':
return classes.small;
default:
return classes.primary;
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/Text/Header/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const useStyles = makeStyles((theme: Theme) => ({
bold: {
fontWeight: 'bold',
},
small: {
fontSize: '1.5rem',
},
}));

export { useStyles };
35 changes: 20 additions & 15 deletions src/core/Text/Paragraph/Paragraph.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,49 @@ storiesOf('Text/ParagraphText', module)
// Litmus Portal
.add('Litmus Portal', () => (
<ThemedBackground platform="litmus-portal" row>
<Paragraph>Paragraph Text</Paragraph>
<Paragraph color={'green'}>Paragraph Text</Paragraph>
<Paragraph variant="small">Paragraph Text</Paragraph>
<Paragraph>Paragraph Text Primary</Paragraph>
<Paragraph color={'green'}>Paragraph Text Colored</Paragraph>
<Paragraph variant="small">Paragraph Text Small</Paragraph>
<Paragraph variant="bold">Paragraph Text Bold</Paragraph>
</ThemedBackground>
))

// Kubera Chaos
.add('Kubera Chaos', () => (
<ThemedBackground platform="kubera-chaos" row>
<Paragraph>Paragraph Text</Paragraph>
<Paragraph color={'green'}>Paragraph Text</Paragraph>
<Paragraph variant="small">Paragraph Text</Paragraph>
<Paragraph>Paragraph Text Primary</Paragraph>
<Paragraph color={'green'}>Paragraph Text Colored</Paragraph>
<Paragraph variant="small">Paragraph Text Small</Paragraph>
<Paragraph variant="bold">Paragraph Text Bold</Paragraph>
</ThemedBackground>
))

// Kubera Propel
.add('Kubera Propel', () => (
<ThemedBackground platform="kubera-propel" row>
<Paragraph>Paragraph Text</Paragraph>
<Paragraph color={'green'}>Paragraph Text</Paragraph>
<Paragraph variant="small">Paragraph Text</Paragraph>
<Paragraph>Paragraph Text Primary</Paragraph>
<Paragraph color={'green'}>Paragraph Text Colored</Paragraph>
<Paragraph variant="small">Paragraph Text Small</Paragraph>
<Paragraph variant="bold">Paragraph Text Bold</Paragraph>
</ThemedBackground>
))

// Kubera Portal
.add('Kubera Portal', () => (
<ThemedBackground platform="kubera-portal" row>
<Paragraph>Paragraph Text</Paragraph>
<Paragraph color={'green'}>Paragraph Text</Paragraph>
<Paragraph variant="small">Paragraph Text</Paragraph>
<Paragraph>Paragraph Text Primary</Paragraph>
<Paragraph color={'green'}>Paragraph Text Colored</Paragraph>
<Paragraph variant="small">Paragraph Text Small</Paragraph>
<Paragraph variant="bold">Paragraph Text Bold</Paragraph>
</ThemedBackground>
))

// Kubera Core
.add('Kubera Core', () => (
<ThemedBackground platform="kubera-core" row>
<Paragraph>Paragraph Text</Paragraph>
<Paragraph color={'green'}>Paragraph Text</Paragraph>
<Paragraph variant="small">Paragraph Text</Paragraph>
<Paragraph>Paragraph Text Primary</Paragraph>
<Paragraph color={'green'}>Paragraph Text Colored</Paragraph>
<Paragraph variant="small">Paragraph Text Small</Paragraph>
<Paragraph variant="bold">Paragraph Text Bold</Paragraph>
</ThemedBackground>
));
8 changes: 4 additions & 4 deletions src/core/Text/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { TypographyBaseProps, Variant } from '../base';
import { useStyles } from './styles';
import { TypographyBaseProps } from '../base';
import Typography from '@material-ui/core/Typography';

type Variant = 'small' | undefined;

interface ParagraphProps extends TypographyBaseProps {
variant?: Variant;
Expand All @@ -15,6 +13,8 @@ const Paragraph: React.FC<ParagraphProps> = ({ color, variant, children }) => {

function getVarinat(variant: Variant): string {
switch (variant) {
case 'bold':
return classes.bold;
case 'small':
return classes.small;
default:
Expand Down
3 changes: 3 additions & 0 deletions src/core/Text/Paragraph/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const useStyles = makeStyles((theme: Theme) => ({
primary: {
fontWeight: 'normal',
},
bold: {
fontWeight: 'bold',
},
small: {
fontSize: '0.75rem',
fontWeight: 'normal',
Expand Down
37 changes: 21 additions & 16 deletions src/core/Text/Subtitle/Subtitle.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import React from 'react';
import { ThemedBackground } from '../../../utils/storybook';
import { Subtitle } from './Subtitle';

storiesOf('Text/SubtitleText', module)
// Litmus Portal
.add('Litmus Portal', () => (
<ThemedBackground platform="litmus-portal" row>
<Subtitle>Subtitle Text</Subtitle>
<Subtitle color={'green'}>Subtitle Text</Subtitle>
<Subtitle variant="small">Subtitle Text</Subtitle>
<Subtitle>Subtitle Text Primary</Subtitle>
<Subtitle color={'green'}>Subtitle Text Colored</Subtitle>
<Subtitle variant="bold">Subtitle Text Bold</Subtitle>
<Subtitle variant="small">Subtitle Text Small</Subtitle>
</ThemedBackground>
))

// Kubera Chaos
.add('Kubera Chaos', () => (
<ThemedBackground platform="kubera-chaos" row>
<Subtitle>Subtitle Text</Subtitle>
<Subtitle color={'green'}>Subtitle Text</Subtitle>
<Subtitle variant="small">Subtitle Text</Subtitle>
<Subtitle>Subtitle Text Primary</Subtitle>
<Subtitle color={'green'}>Subtitle Text Colored</Subtitle>
<Subtitle variant="bold">Subtitle Text Bold</Subtitle>
<Subtitle variant="small">Subtitle Text Small</Subtitle>
</ThemedBackground>
))

// Kubera Propel
.add('Kubera Propel', () => (
<ThemedBackground platform="kubera-propel" row>
<Subtitle>Subtitle Text</Subtitle>
<Subtitle color={'green'}>Subtitle Text</Subtitle>
<Subtitle variant="small">Subtitle Text</Subtitle>
<Subtitle>Subtitle Text Primary</Subtitle>
<Subtitle color={'green'}>Subtitle Text Colored</Subtitle>
<Subtitle variant="bold">Subtitle Text Bold</Subtitle>
<Subtitle variant="small">Subtitle Text Small</Subtitle>
</ThemedBackground>
))

// Kubera Portal
.add('Kubera Portal', () => (
<ThemedBackground platform="kubera-portal" row>
<Subtitle>Subtitle Text</Subtitle>
<Subtitle color={'green'}>Subtitle Text</Subtitle>
<Subtitle variant="small">Subtitle Text</Subtitle>
<Subtitle>Subtitle Text Primary</Subtitle>
<Subtitle color={'green'}>Subtitle Text Colored</Subtitle>
<Subtitle variant="bold">Subtitle Text Bold</Subtitle>
<Subtitle variant="small">Subtitle Text Small</Subtitle>
</ThemedBackground>
))

// Kubera Core
.add('Kubera Core', () => (
<ThemedBackground platform="kubera-core" row>
<Subtitle>Subtitle Text</Subtitle>
<Subtitle color={'green'}>Subtitle Text</Subtitle>
<Subtitle variant="small">Subtitle Text</Subtitle>
<Subtitle>Subtitle Text Primary</Subtitle>
<Subtitle color={'green'}>Subtitle Text Colored</Subtitle>
<Subtitle variant="bold">Subtitle Text Bold</Subtitle>
<Subtitle variant="small">Subtitle Text Small</Subtitle>
</ThemedBackground>
));
8 changes: 4 additions & 4 deletions src/core/Text/Subtitle/Subtitle.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { TypographyBaseProps, Variant } from '../base';
import { useStyles } from './styles';
import { TypographyBaseProps } from '../base';
import Typography from '@material-ui/core/Typography';

type Variant = 'small' | undefined;

interface SubtitleProps extends TypographyBaseProps {
variant?: Variant;
Expand All @@ -15,6 +13,8 @@ const Subtitle: React.FC<SubtitleProps> = ({ color, variant, children }) => {

function getVariant(variant: Variant): string {
switch (variant) {
case 'bold':
return classes.bold;
case 'small':
return classes.small;
default:
Expand Down
3 changes: 3 additions & 0 deletions src/core/Text/Subtitle/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const useStyles = makeStyles((theme: Theme) => ({
primary: {
fontWeight: 'normal',
},
bold: {
fontWeight: 'bold',
},
small: {
fontSize: '0.75rem',
fontWeight: 'normal',
Expand Down
2 changes: 2 additions & 0 deletions src/core/Text/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export type TypographyBaseProps = Omit<
TypographyProps,
'variant' | 'variantMapping' | 'color' | 'paragraph'
>;

export type Variant = 'bold' | 'small' | undefined;