Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
typography: add Meta (#70)
Browse files Browse the repository at this point in the history
* typography: add Meta

* use Meta types
  • Loading branch information
seanmcintyre authored Nov 17, 2021
1 parent 8c6983c commit f642acc
Showing 4 changed files with 84 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/typography/Meta/Meta.story.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { Story } from '@storybook/react';

import { Meta } from './Meta';
import { Props } from './Meta.types';

export default {
title: 'typography/Meta',
component: Meta,
argTypes: {
contentEditable: { control: { disable: true } },
},
};

const Template: Story<Props> = (args) => {
return (
<>
<Meta {...args}>Meta</Meta>
</>
);
};
export const Controls = Template.bind({});
Controls.storyName = 'Meta';
15 changes: 15 additions & 0 deletions src/typography/Meta/Meta.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* stylelint-disable */

import styled from 'styled-components';

import { Text } from '../Text/Text';

export const Meta = styled(Text)`
line-height: 1.5;
font-weight: 400;
letter-spacing: 0.1px;
font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizelegibility;
`;
28 changes: 28 additions & 0 deletions src/typography/Meta/Meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';

import { Props } from './Meta.types';
import { Meta as Styled } from './Meta.style';

import { withIris } from '../../utils';

export const Meta = withIris<
HTMLParagraphElement | HTMLSpanElement | HTMLLabelElement,
Props
>(MetaComponent);

function MetaComponent({
element = 'span',
forwardRef,
format = 'basic',
...props
}: Props) {
return (
<Styled
element={element}
format={format}
ref={forwardRef}
size={100}
{...props}
/>
);
}
18 changes: 18 additions & 0 deletions src/typography/Meta/Meta.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { IrisProps } from '../../utils';
import { Statuses } from '../../themes';

export type Props = IrisProps<
{
contentEditable?: never;
/**
* [default = 'span']
*/
element?: 'p' | 'span' | 'label';
/**
* [default = 'basic']
*/
format?: 'basic' | 'soft' | 'alternative';
status?: Statuses;
},
HTMLParagraphElement
>;

0 comments on commit f642acc

Please # to comment.