Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 4ebc21a

Browse files
committed
addressed comments
1 parent 87ae826 commit 4ebc21a

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

src/lib/colorUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SiteVariablesInput, ColorVariants, ColorValues } from '../themes/types'
33

44
export const mapColorsToScheme = <T>(
55
siteVars: SiteVariablesInput,
6-
mapper: string | number | keyof ColorVariants | ((color: ColorVariants) => T),
6+
mapper: keyof ColorVariants | ((color: ColorVariants) => T),
77
): ColorValues<T> =>
88
_.mapValues(
99
{ ...siteVars.emphasisColors, ...siteVars.naturalColors },

src/themes/teams/components/Divider/dividerStyles.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ import { ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types'
66
import { DividerPropsWithDefaults } from '../../../../components/Divider/Divider'
77
import { DividerVariables } from './dividerVariables'
88

9-
const beforeAndAfter = (color, size, variables: DividerVariables): ICSSInJSStyle => ({
9+
const beforeAndAfter = (
10+
color: string,
11+
size: number,
12+
variables: DividerVariables,
13+
): ICSSInJSStyle => ({
1014
content: '""',
1115
flex: 1,
1216
height: `${size + 1}px`,
13-
background: color ? _.get(variables.colors, color) : variables.dividerColor,
17+
background: _.get(variables.colors, color, variables.dividerColor),
1418
})
1519

1620
const dividerStyles: ComponentSlotStylesInput<DividerPropsWithDefaults, DividerVariables> = {
1721
root: ({ props, variables }): ICSSInJSStyle => {
1822
const { children, color, fitted, size, important, content } = props
1923
return {
20-
color: color ? _.get(variables.colors, color) : variables.textColor,
24+
color: _.get(variables.colors, color, variables.textColor),
2125
display: 'flex',
2226
alignItems: 'center',
2327
...(!fitted && {

src/themes/teams/components/Divider/dividerVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface DividerVariables {
1616
}
1717

1818
export default (siteVars: any): DividerVariables => {
19-
const colorVariant = '500'
19+
const colorVariant = 500
2020

2121
return {
2222
colors: mapColorsToScheme(siteVars, colorVariant),

src/themes/teams/components/Text/textStyles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
}: ComponentStyleFunctionParam<TextProps, TextVariables>): ICSSInJSStyle => {
2525
return {
2626
display: 'inline-block',
27-
...(color && { color: _.get(v.colors, color) }),
27+
color: _.get(v.colors, color),
2828
...(truncated && truncateStyle),
2929
...(atMention === true && {
3030
color: v.atMentionOtherColor,

src/themes/teams/components/Text/textVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface TextVariables {
3333
}
3434

3535
export default (siteVariables): TextVariables => {
36-
const colorVariant = '500'
36+
const colorVariant = 500
3737

3838
return {
3939
colors: mapColorsToScheme(siteVariables, colorVariant),

src/themes/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export type EmphasisColors = Extendable<EmphasisColorsStrict, ColorVariants>
7777
type ColorNames = keyof (EmphasisColorsStrict & NaturalColorsStrict)
7878

7979
/**
80-
* A type for extracting the color names and values.
80+
* A type for an extendable set of ColorNames properties of type T
8181
*/
82-
export type ColorValues<T> = Partial<Record<ColorNames, T>>
82+
export type ColorValues<T> = Extendable<Partial<Record<ColorNames, T>>, T>
8383

8484
/**
8585
* A type for a base colors.

0 commit comments

Comments
 (0)