Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed Sep 21, 2023
1 parent 77823e1 commit 1149f39
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/content/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import React, {
CSSProperties,
} from 'react';
import { css } from '@emotion/react';
<<<<<<< HEAD
import { ColorValue, DOMProps, DOMRef, StyleProps } from '../types';
import { useDOMRef } from '../utils/useDOMRef';
import theme, { designationColors } from '../theme';
import { TextColor, Size, TextElementType, Weight } from './types';
=======
import { DOMRef, TextColorValue } from '../types';
import { useDOMRef } from '../utils/useDOMRef';
import theme from '../theme';
import { Size, TextElementType, Weight } from './types';
>>>>>>> 2afd5d8 (WIP)
import { textSizeCSS, textWeightCSS } from './styles';
import { filterDOMProps } from '@react-aria/utils';
import { colorValue, useStyleProps } from '../utils';
Expand Down Expand Up @@ -37,12 +44,16 @@ export interface TextProps extends DOMProps, StyleProps {
* The color of the text
* @default 'white90'
*/
<<<<<<< HEAD
color?: TextColor;
/**
* The font style
* @default 'normal'
*/
fontStyle?: CSSProperties['fontStyle'];
=======
color?: TextColorValue;
>>>>>>> 2afd5d8 (WIP)
/**
* The disabled state of the text
*/
Expand All @@ -53,6 +64,7 @@ export interface TextProps extends DOMProps, StyleProps {
className?: string;
}

<<<<<<< HEAD
const getTextColor = (color: TextColor) => {
if (color.startsWith('designation')) {
// Return the designation color (e.x. the main primary / reference colors)
Expand All @@ -65,6 +77,9 @@ const getTextColor = (color: TextColor) => {
return colorValue(color as ColorValue);
};
const textCSS = (color: TextColor) => css`
=======
const textCSS = (color: TextColorValue) => css`
>>>>>>> 2afd5d8 (WIP)
/* default to no margin */
margin: 0;
color: ${getTextColor(color)};
Expand Down
3 changes: 3 additions & 0 deletions src/content/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type Size =

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

<<<<<<< HEAD
export type TextColor =
| 'white90'
| 'white70'
Expand All @@ -19,6 +20,8 @@ export type TextColor =
| DesignationColorValue
| ColorValue;

=======
>>>>>>> 2afd5d8 (WIP)
export type TextElementType =
| 'span'
| 'h1'
Expand Down
4 changes: 4 additions & 0 deletions src/types/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ export type ColorValue =
| 'warning'
| 'danger';

<<<<<<< HEAD
export type DesignationColorValue =
| 'designationPurple'
| 'designationTurquoise';
=======
export type TextColorValue = 'white90' | 'white70' | 'white30' | 'inherit';
>>>>>>> 2afd5d8 (WIP)
32 changes: 32 additions & 0 deletions stories/Colors.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,62 @@ function Colors() {
</li>
))}
</ul>
z
</section>
);
});

const designationColorKeys = Object.keys(designationColors);
const designations = (
<section>
<Heading>Designation Colors</Heading>
<ul style={listStyle}>
<<<<<<< HEAD
{Object.keys(designationColors)
.filter(c => c.startsWith('designation'))
.map((c, i) => (
<li key={i}>
<Color color={designationColors[c]} name={c} />
</li>
))}
=======
{designationColorKeys.map((c, i) => (
<li key={i}>
<Color color={designationColors[c]} name={c} />
</li>
))}
>>>>>>> 2afd5d8 (WIP)
</ul>
</section>
);

<<<<<<< HEAD
const colorPaletteSection = (
<section>
<Heading>Color Palette</Heading>
<ColorGradient colorGradient={colorPalette.purpleColors} />
<ColorGradient colorGradient={colorPalette.turquoiseColors} />
<ColorGradient colorGradient={colorPalette.grayColors} />
=======
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> */}
>>>>>>> 2afd5d8 (WIP)
</section>
);

Expand All @@ -123,6 +154,7 @@ function Colors() {
<br />
{colorPaletteSection}
{designations}
{colorPaletteEl}
{components}
</main>
);
Expand Down

0 comments on commit 1149f39

Please sign in to comment.