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

remove old label animation #2196

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions packages/core/docs/vibe-3-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
### Label

- `wrapperClassName` -> `className` [codemod]
- Removed old animation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rephrase "old" as "slide" or "rotate", to make it more clear
Plus I think we should specify the isAnimationDisabled prop that was removed


### EditableHeading

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ export const SearchableDropdown = {
export const DropdownWithLabels = {
render: () => {
const labelRenderer = useCallback(({ label, color }) => {
return <Label text={label} color={color} isAnimationDisabled />;
return <Label text={label} color={color} />;
}, []);

const options = useMemo(
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/components/Label/Label.tsx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet there's some redundant CSS also 😅

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export interface LabelProps extends VibeComponentProps {
kind?: LabelKind;
color?: LabelColor;
text?: string;
isAnimationDisabled?: boolean;
isLegIncluded?: boolean;
onClick?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
celebrationAnimation?: boolean;
Expand All @@ -39,7 +38,6 @@ const Label: VibeComponent<LabelProps> & {
kind = LabelKind.FILL,
color = LabelColor.PRIMARY,
text = "",
isAnimationDisabled = false,
isLegIncluded = false,
id,
"data-testid": dataTestId,
Expand All @@ -62,15 +60,13 @@ const Label: VibeComponent<LabelProps> & {
getStyle(styles, camelCase("kind" + "-" + kind)),
getStyle(styles, camelCase("color" + "-" + color)),
{
// When celebrationAnimation is active it wins over the default animation
[styles.withAnimation]: !isAnimationDisabled && !isCelebrationAnimation,
[styles.withLeg]: isLegIncluded,
[styles.clickable]: isClickable,
[styles.small]: size === "small"
},
labelClassName
),
[kind, color, isAnimationDisabled, isLegIncluded, labelClassName, isCelebrationAnimation, isClickable, size]
[kind, color, isLegIncluded, labelClassName, isClickable, size]
);

const onClickCallback = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const Celebration = {

return (
<>
<Label text="New" kind={Label.kinds.LINE} celebrationAnimation={animate} isAnimationDisabled />
<Label text="New" kind={Label.kinds.LINE} celebrationAnimation={animate} />
<Button size={Button.sizes.SMALL} kind={Button.kinds.TERTIARY} onClick={() => setAnimate(true)}>
Click to celebrate
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("Label renders correctly", () => {
});

it("without animation", () => {
const tree = renderer.create(<Label text="Test" isAnimationDisabled />).toJSON();
const tree = renderer.create(<Label text="Test" />).toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ A highlighted row allows adding additional information for the entire row, using
<Label
text={rowItem.status}
color={statusColumnToLabelColor[rowItem.status]}
isAnimationDisabled
/>
</TableCell>
</TableRow>
Expand Down Expand Up @@ -151,7 +150,6 @@ A highlighted row allows adding additional information for the entire row, using
<Label
text={rowItem.status}
color={statusColumnToLabelColor[rowItem.status]}
isAnimationDisabled
/>
</TableCell>
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const Overview = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} color="positive" isAnimationDisabled />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down Expand Up @@ -357,7 +357,7 @@ export const Borders = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} color="positive" isAnimationDisabled />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand All @@ -379,7 +379,7 @@ export const Borders = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} color="positive" isAnimationDisabled />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down Expand Up @@ -435,7 +435,7 @@ export const TableHeaderFunctionality = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} isAnimationDisabled color="positive" />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down Expand Up @@ -472,7 +472,7 @@ export const Loading = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} color="positive" isAnimationDisabled />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down Expand Up @@ -503,18 +503,14 @@ export const Scroll = {
<TableRow key={rowItem.id}>
<TableCell>{rowItem.sentOn}</TableCell>
<TableCell>
<Label
text={rowItem.priority}
color={priorityColumnToLabelColor[rowItem.priority]}
isAnimationDisabled
/>
<Label text={rowItem.priority} color={priorityColumnToLabelColor[rowItem.priority]} />
</TableCell>
<TableCell>{rowItem.subject}</TableCell>
<TableCell>
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} color={statusColumnToLabelColor[rowItem.status]} isAnimationDisabled />
<Label text={rowItem.status} color={statusColumnToLabelColor[rowItem.status]} />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down Expand Up @@ -582,7 +578,7 @@ export const HighlightedRow = {
<TableAvatar text={rowItem.sentBy} />
</TableCell>
<TableCell>
<Label text={rowItem.status} isAnimationDisabled color="positive" />
<Label text={rowItem.status} color="positive" />
</TableCell>
<TableCell>{rowItem.emailsSent}</TableCell>
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export const TableDescription = () => {
<Label
text={rowItem.status}
color={statusColumnToLabelColor[rowItem.status as keyof typeof statusColumnToLabelColor]}
isAnimationDisabled
/>
</TableCell>
</TableRow>
Expand Down
Loading