Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spelling of typography value #1161

Merged
merged 1 commit into from
Aug 15, 2022
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import Box from '../Box';
import { TokenTypograpyValue } from '@/types/values';
import { TokenTypographyValue } from '@/types/values';

// @TODO confirm whether the typography token values
// can still have the .value property from legacy

type Props = {
value: TokenTypograpyValue
value: TokenTypographyValue
shouldResolve: boolean
};

Expand Down
6 changes: 3 additions & 3 deletions src/app/components/TokenTooltip/TokenTooltipContentValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { SingleToken } from '@/types/tokens';
import { SingleShadowValueDisplay } from './SingleShadowValueDisplay';
import { TokensContext } from '@/context';
import { isSingleBoxShadowToken, isSingleTypographyToken, isSingleCompositionToken } from '@/utils/is';
import { SingleTypographyValueDisplay } from './SingleTypograhpyValueDisplay';
import { TokenBoxshadowValue, TokenTypograpyValue } from '@/types/values';
import { SingleTypographyValueDisplay } from './SingleTypographyValueDisplay';
import { TokenBoxshadowValue, TokenTypographyValue } from '@/types/values';
import Box from '../Box';
import { SingleCompositionValueDisplay } from './SingleCompositionValueDisplay';

Expand Down Expand Up @@ -37,7 +37,7 @@ export const TokenTooltipContentValue: React.FC<Props> = ({ token, shouldResolve
if (isSingleTypographyToken(token)) {
return (
<SingleTypographyValueDisplay
value={valueToCheck as TokenTypograpyValue}
value={valueToCheck as TokenTypographyValue}
shouldResolve={shouldResolve}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions src/types/CompositionTokenProperty.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Properties } from '@/constants/Properties';
import type { TokenTypes } from '@/constants/TokenTypes';
import { TokenBoxshadowValue, TokenTypograpyValue } from './values';
import { TokenBoxshadowValue, TokenTypographyValue } from './values';

export type CompositionTokenProperty = keyof typeof Properties;

export type CompositionTokenValue = Partial<
Record<TokenTypes, string | number | TokenTypograpyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue>>
& Record<Properties, string | number | TokenTypograpyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue>>
Record<TokenTypes, string | number | TokenTypographyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue>>
& Record<Properties, string | number | TokenTypographyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue>>
>;
4 changes: 2 additions & 2 deletions src/types/tokens/SingleTypographyToken.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TokenTypes } from '@/constants/TokenTypes';
import { TokenTypograpyValue } from '../values';
import { TokenTypographyValue } from '../values';
import { SingleGenericToken } from './SingleGenericToken';

export type SingleTypographyToken<Named extends boolean = true, P = unknown> = SingleGenericToken<TokenTypes.TYPOGRAPHY, TokenTypograpyValue | string, Named, P>;
export type SingleTypographyToken<Named extends boolean = true, P = unknown> = SingleGenericToken<TokenTypes.TYPOGRAPHY, TokenTypographyValue | string, Named, P>;
2 changes: 1 addition & 1 deletion src/types/values/TokenTypographyValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type TokenTypograpyValue = {
export type TokenTypographyValue = {
fontFamily?: string;
fontWeight?: string;
fontSize?: string;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/alias/getAliasValue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TokenTypes } from '@/constants/TokenTypes';
import { SingleToken } from '@/types/tokens';
import { TokenBoxshadowValue, TokenTypograpyValue } from '@/types/values';
import { TokenBoxshadowValue, TokenTypographyValue } from '@/types/values';
import { convertToRgb } from '../color';
import { findReferences } from '../findReferences';
import { isSingleTokenValueObject } from '../is';
Expand All @@ -19,7 +19,7 @@ function getReturnedValue(token: SingleToken | string | number) {
}

function replaceAliasWithResolvedReference(
token: string | TokenTypograpyValue | TokenBoxshadowValue | TokenBoxshadowValue[] | null,
token: string | TokenTypographyValue | TokenBoxshadowValue | TokenBoxshadowValue[] | null,
reference: string,
resolvedReference: string | number | TokenBoxshadowValue | TokenBoxshadowValue[] | Record<string, unknown> | null,
) {
Expand All @@ -35,7 +35,7 @@ function replaceAliasWithResolvedReference(
}

// @TODO This function logic needs to be explained to improve it. It is unclear at this time which cases it needs to handle and how
export function getAliasValue(token: SingleToken | string | number, tokens: SingleToken[] = []): string | number | TokenTypograpyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue> | null {
export function getAliasValue(token: SingleToken | string | number, tokens: SingleToken[] = []): string | number | TokenTypographyValue | TokenBoxshadowValue | Array<TokenBoxshadowValue> | null {
// @TODO not sure how this will handle typography and boxShadow values. I don't believe it works.
// The logic was copied from the original function in aliases.tsx
let returnedValue: ReturnType<typeof getReturnedValue> | null = getReturnedValue(token);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getValueWithReferences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TokenTypes } from '@/constants/TokenTypes';
import { SingleToken } from '@/types/tokens';
import { TokenBoxshadowValue, TokenTypograpyValue } from '@/types/values';
import { TokenBoxshadowValue, TokenTypographyValue } from '@/types/values';
import { TransformerOptions } from './types';

function getSimpleValue(resolvedValue: SingleToken['value'], rawValue: SingleToken['value'], options: TransformerOptions) {
Expand Down Expand Up @@ -62,7 +62,7 @@ export function getValueWithReferences(token: SingleToken, options: TransformerO
const rawValue = token.rawValue as TokenBoxshadowValue[];
return token.value.map((shadow, index) => getComplexValue(shadow, rawValue[index], options));
}
return getComplexValue(token.value, token.rawValue as TokenTypograpyValue | TokenBoxshadowValue, options);
return getComplexValue(token.value, token.rawValue as TokenTypographyValue | TokenBoxshadowValue, options);
}

return getSimpleValue(token.value, token.rawValue, options);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/is/isSingleTypographyValue.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { MapValuesToTokensResult } from '@/types';
import type { SingleTypographyToken } from '@/types/tokens';
import type { TokenTypograpyValue } from '@/types/values';
import type { TokenTypographyValue } from '@/types/values';

export function isSingleTypographyValue(value: MapValuesToTokensResult[string]): value is SingleTypographyToken['value'] {
return Boolean(
value
&& (
typeof value === 'string'
|| ((Array.isArray(value) ? value : [value]) as (
(TokenTypograpyValue | Extract<MapValuesToTokensResult[string], { property: string }[]>[number])[]
(TokenTypographyValue | Extract<MapValuesToTokensResult[string], { property: string }[]>[number])[]
)).every((v) => (
v && typeof v === 'object'
&& (
Expand Down