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

typography: add Meta #70

Merged
merged 2 commits into from
Nov 17, 2021
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
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
>;