Skip to content

Commit

Permalink
Remove extralarge from Tokens (#3313)
Browse files Browse the repository at this point in the history
* Remove extralarge from Tokens

* add changeset
  • Loading branch information
broccolinisoup authored Jun 6, 2023
1 parent 5d31e62 commit 77d4042
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 1,361 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-spies-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Remove deprecated `extralarge` variant from `Token` and `TextInputWithToken` component
6 changes: 2 additions & 4 deletions src/TextInputWithTokens/TextInputWithTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ const overflowCountFontSizeMap: Record<TokenSizeKeys, number> = {
small: 0,
medium: 1,
large: 1,
extralarge: 2,
xlarge: 2, // will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: 2,
}

// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
Expand Down Expand Up @@ -240,8 +239,7 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
small: 'small',
medium: 'small',
large: 'medium',
extralarge: 'medium',
xlarge: 'medium', // will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: 'medium',
}
const showLeadingLoadingIndicator =
loading && (loaderPosition === 'leading' || Boolean(LeadingVisual && loaderPosition !== 'trailing'))
Expand Down
2 changes: 1 addition & 1 deletion src/Token/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const LeadingVisualContainer: React.FC<React.PropsWithChildren<Pick<TokenBasePro
sx={{
flexShrink: 0,
lineHeight: 0,
marginRight: size && ['large', 'extralarge', 'xlarge'].includes(size) ? 2 : 1,
marginRight: size && ['large', 'xlarge'].includes(size) ? 2 : 1,
}}
>
{children}
Expand Down
11 changes: 2 additions & 9 deletions src/Token/TokenBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'

// TODO: remove invalid "extralarge" size name in next breaking change
/** @deprecated 'extralarge' to be removed to align with size naming ADR https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md **/
type ExtraLarge = 'extralarge'
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'xlarge' | ExtraLarge

const xlargeSize = '32px'
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'xlarge'

export const tokenSizes: Record<TokenSizeKeys, string> = {
small: '16px',
medium: '20px',
large: '24px',
extralarge: xlargeSize,
xlarge: xlargeSize,
xlarge: '32px',
}

export const defaultTokenSize: TokenSizeKeys = 'medium'
Expand Down Expand Up @@ -112,7 +106,6 @@ const variants = variant<
paddingLeft: 2,
paddingRight: 2,
},
extralarge: xlargeVariantStyles,
xlarge: xlargeVariantStyles,
},
})
Expand Down
6 changes: 0 additions & 6 deletions src/Token/_RemoveTokenButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ const variants = variant<{height: string; width: string}, TokenSizeKeys>({
height: tokenSizes.large,
width: tokenSizes.large,
},
extralarge: {
height: tokenSizes.extralarge,
width: tokenSizes.extralarge,
},
// xlarge will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: {
height: tokenSizes.xlarge,
width: tokenSizes.xlarge,
Expand Down Expand Up @@ -62,7 +57,6 @@ const StyledTokenButton = styled.span<TokenButtonProps & SxProp>`
${props => {
switch (props.size) {
case 'large':
case 'extralarge':
case 'xlarge':
return css`
margin-left: ${get('space.2')};
Expand Down
Loading

0 comments on commit 77d4042

Please sign in to comment.