Skip to content

Commit

Permalink
fix: keep text
Browse files Browse the repository at this point in the history
  • Loading branch information
Niznikr committed Oct 1, 2024
1 parent 59dc44d commit b352142
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
10 changes: 5 additions & 5 deletions packages/components/src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { cva, cx } from 'class-variance-authority';
import { forwardRef } from 'react';
import {
Button as AriaButton,
Provider,
SelectContext,
TextContext,
composeRenderProps,
useSlottedContext,
} from 'react-aria-components';
Expand Down Expand Up @@ -57,12 +59,10 @@ const _Button = (
)}
>
{composeRenderProps(props.children, (children, { isPending }) => (
<>
<Provider values={[[TextContext, { className: isPending ? styles.pending : undefined }]]}>
{children}
{isPending && (
<ProgressBar isIndeterminate aria-label="loading" className={styles.progress} />
)}
</>
{isPending && <ProgressBar isIndeterminate aria-label="loading" />}
</Provider>
))}
</AriaButton>
);
Expand Down
12 changes: 2 additions & 10 deletions packages/components/src/styles/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,6 @@
z-index: 1;
}

.base[data-pending] {
position: relative;
color: transparent;
}

.progress {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.pending {
opacity: 50%;
}
4 changes: 2 additions & 2 deletions packages/components/stories/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { vars } from '@launchpad-ui/vars';
import { fireEvent, userEvent, within } from '@storybook/test';
import { useEffect, useRef, useState } from 'react';

import { Button } from '../src';
import { Button, Text } from '../src';

const meta: Meta<typeof Button> = {
component: Button,
Expand Down Expand Up @@ -157,7 +157,7 @@ export const Pending: Story = {
return <Button isPending={isPending} onPress={handlePress} {...args} />;
},
args: {
children: 'Pending',
children: <Text>Pending</Text>,
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
Expand Down

0 comments on commit b352142

Please sign in to comment.