Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed May 25, 2023
1 parent eaeb23c commit 2afd5d8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 211 deletions.
8 changes: 4 additions & 4 deletions src/content/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ElementType, ReactNode, forwardRef, HTMLProps } from 'react';
import { css } from '@emotion/react';
import { DOMRef } from '../types';
import { DOMRef, TextColorValue } from '../types';
import { useDOMRef } from '../utils/useDOMRef';
import theme from '../theme';
import { Color, Size, TextElementType, Weight } from './types';
import { Size, TextElementType, Weight } from './types';
import { textSizeCSS, textWeightCSS } from './styles';

export interface TextProps extends HTMLProps<HTMLSpanElement> {
Expand All @@ -30,7 +30,7 @@ export interface TextProps extends HTMLProps<HTMLSpanElement> {
* The color of the text
* @default 'white90'
*/
color?: Color;
color?: TextColorValue;
/**
* The disabled state of the text
*/
Expand All @@ -41,7 +41,7 @@ export interface TextProps extends HTMLProps<HTMLSpanElement> {
className?: string;
}

const textCSS = (color: Color) => css`
const textCSS = (color: TextColorValue) => css`
/* default to no margin */
margin: 0;
color: ${theme.textColors[color]};
Expand Down
2 changes: 0 additions & 2 deletions src/content/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export type Size =

export type Weight = 'heavy' | 'normal';

export type Color = 'white90' | 'white70' | 'white30' | 'inherit';

export type TextElementType =
| 'span'
| 'h1'
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export * from './empty';
export * from './contextualhelp';
export * from './counter';
export * from './layout';
export { theme, designationColors } from './theme';
export { theme, designationColors, colorPalette } from './theme';
// export interface Props extends HTMLAttributes<HTMLDivElement> {
// /** custom content, defaults to 'the snozzberries taste like snozzberries' */
// children?: ReactChild;
Expand Down
202 changes: 0 additions & 202 deletions src/theme.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/types/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ export type ColorValue =
| 'gray-800'
| 'gray-900'
| 'danger';

export type TextColorValue = 'white90' | 'white70' | 'white30' | 'inherit';
28 changes: 26 additions & 2 deletions stories/Colors.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { CSSProperties } from 'react';
import { theme, designationColors, Text, Heading } from '../src';
import { theme, designationColors, colorPalette, Text, Heading } from '../src';
import { Meta, Story } from '@storybook/react';
// @ts-ignore
import { withDesign } from 'storybook-addon-designs';
Expand Down Expand Up @@ -60,15 +60,17 @@ function Colors() {
</li>
))}
</ul>
z
</section>
);
});

const designationColorKeys = Object.keys(designationColors);
const designations = (
<section>
<Heading>Designation Colors</Heading>
<ul style={listStyle}>
{Object.keys(designationColors).map((c, i) => (
{designationColorKeys.map((c, i) => (
<li key={i}>
<Color color={designationColors[c]} name={c} />
</li>
Expand All @@ -77,6 +79,27 @@ function Colors() {
</section>
);

const colorGroups = Object.keys(colorPalette);
const colorPaletteEl = (
<section>
<Heading>Color Palette</Heading>
{/* <div>
{colorGroups.map((colorGroup, i) => {
return (
<div>
{colorGroup}
<ul>
{colorPalette[colorGroup].map(color => (
<li>{color}</li>
))}
</ul>
</div>
);
})}
</div> */}
</section>
);

return (
<main>
<ul style={listStyle}>
Expand All @@ -86,6 +109,7 @@ function Colors() {
</ul>
<br />
{designations}
{colorPaletteEl}
{components}
</main>
);
Expand Down

0 comments on commit 2afd5d8

Please sign in to comment.