Skip to content

Commit

Permalink
use avatar's text styles for moreItems text in stackingroup
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoskolodny committed Nov 25, 2024
1 parent c4a0749 commit eba205d
Show file tree
Hide file tree
Showing 24 changed files with 5 additions and 8 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type AvatarProps = {
/**
* Not using TextPresets here because we don't want to scale the avatar text with the device settings
*/
const renderText = (size: number, text: string): JSX.Element | null => {
export const renderText = (size: number, text: string): JSX.Element | null => {
if (!text) {
return null;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions src/stacking-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as React from 'react';
import {useIsInverseOrMediaVariant} from './theme-variant-context';
import {vars} from './skins/skin-contract.css';
import Inline from './inline';
import {Text4} from './text';
import * as styles from './stacking-group.css';
import * as mediaStyles from './image.css';
import {applyCssVars} from './utils/css';
import {renderText} from './avatar';

type Props = {
stacked?: boolean;
Expand All @@ -31,6 +31,7 @@ const StackingGroup = ({
const size = moreItemsStyle.size;

const borderRadius = moreItemsStyle.type === 'circle' ? '50%' : vars.borderRadii.mediaSmall;
const textColor = isInverse ? vars.colors.textPrimaryInverse : vars.colors.textBrand;

return (
<div
Expand All @@ -49,17 +50,13 @@ const StackingGroup = ({
style={{
width: size,
height: size,
color: textColor,
borderRadius,
backgroundColor: isInverse ? vars.colors.brandHigh : vars.colors.brandLow,
border: stacked ? `1px solid ${vars.colors.borderLow}` : 'none',
}}
>
<Text4
regular
color={isInverse ? vars.colors.textPrimaryInverse : vars.colors.textBrand}
>
{'+' + moreItemsCount}
</Text4>
{renderText(size, `+${moreItemsCount}`)}
</div>
)}
</Inline>
Expand Down

0 comments on commit eba205d

Please sign in to comment.