Skip to content

Commit

Permalink
feat: continue
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao committed Mar 4, 2024
1 parent a19835e commit 97c40b4
Show file tree
Hide file tree
Showing 52 changed files with 270 additions and 641 deletions.
5 changes: 5 additions & 0 deletions .storybook/preview-body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style>
body {
color: #ffffff;
}
</style>
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@interlay/system": "workspace:*",
"@interlay/theme": "workspace:*",
"@interlay/themev2": "workspace:*",
"@radix-ui/react-slot": "^1.0.2",
"@react-aria/accordion": "3.0.0-alpha.20",
"@react-aria/breadcrumbs": "^3.5.4",
"@react-aria/button": "^3.8.1",
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ export const Icon: StoryObj<ButtonProps> = {
}
};

export const Link: StoryObj<ButtonProps> = {
args: {
asChild: true,
// eslint-disable-next-line jsx-a11y/anchor-is-valid
children: <a href='#'>Link</a>
}
};

// export const Secondary: StoryObj<ButtonProps> = {
// args: {
// variant: 'secondary'
Expand Down
8 changes: 7 additions & 1 deletion packages/components/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { mergeProps } from '@react-aria/utils';
import { PressEvent } from '@react-types/shared';
import { ButtonHTMLAttributes, forwardRef } from 'react';
import { ButtonVariants, ButtonSizes, ButtonColors, SpinnerSizes, SpinnerColors } from '@interlay/themev2';
import { Slot, Slottable } from '@radix-ui/react-slot';

import { Flex } from '../Flex';
import { Spinner } from '../Spinner';
Expand Down Expand Up @@ -39,6 +40,7 @@ type Props = {
color?: ButtonColors;
loading?: boolean;
isIconOnly?: boolean;
asChild?: boolean;
onPress?: (e: PressEvent) => void;
};

Expand All @@ -59,6 +61,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
isIconOnly,
onPress,
onClick,
asChild,
...props
},
ref
Expand All @@ -70,6 +73,8 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
const { buttonProps } = useButton({ isDisabled, onPress, ...props }, domRef);
const { focusProps, isFocusVisible } = useFocusRing(props);

const Comp = asChild ? Slot : 'button';

return (
<StyledButton
ref={domRef}
Expand All @@ -79,6 +84,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
$isIconOnly={isIconOnly}
$size={size}
$variant={variant}
as={Comp}
disabled={isDisabled}
{...mergeProps(props, buttonProps, focusProps, { onClick })}
>
Expand All @@ -87,7 +93,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
<Spinner aria-label='Loading...' color={spinnerColorMap[color][variant]} size={spinnerSizeMap[size]} />
</Flex>
)}
{isIconOnly ? (loading ? undefined : children) : children}
{isIconOnly ? loading ? undefined : <Slottable>{children}</Slottable> : <Slottable>{children}</Slottable>}
</StyledButton>
);
}
Expand Down
36 changes: 0 additions & 36 deletions packages/components/src/CoinIcon/CoinIcon.stories.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions packages/components/src/CoinIcon/CoinIcon.style.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions packages/components/src/CoinIcon/CoinIcon.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions packages/components/src/CoinIcon/FallbackIcon.tsx

This file was deleted.

65 changes: 0 additions & 65 deletions packages/components/src/CoinIcon/LPCoinIcon.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions packages/components/src/CoinIcon/__tests__/Card.test.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/components/src/CoinIcon/index.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions packages/components/src/CoinIcon/types.ts

This file was deleted.

43 changes: 19 additions & 24 deletions packages/components/src/Dialog/Dialog.style.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,49 @@
import styled from 'styled-components';
import styled, { css } from 'styled-components';
import { DialogSize } from '@interlay/themev2';

import { theme } from '../../../core/theme/src';
import { Sizes } from '../../../core/theme/src';
import { CTA } from '../CTA';
import { Divider } from '../Divider';
import { Flex } from '../Flex';
import { H3 } from '../Text';
import { Button } from '../Button';

type StyledDialogProps = {
$size: Sizes;
$size: DialogSize;
};

const StyledDialog = styled.section<StyledDialogProps>`
background: ${theme.colors.bgPrimary};
border: ${theme.border.default};
border-radius: ${theme.rounded.md};
color: ${theme.colors.textPrimary};
max-width: 100%;
width: ${({ $size }) => theme.dialog[$size].width};
display: flex;
flex-direction: column;
position: relative;
outline: none;
${({ theme, $size }) => css`
${theme.dialog.base}
${theme.dialog.size[$size].base}
`}
`;

const StyledCloseCTA = styled(CTA)`
const StyledCloseCTA = styled(Button)`
position: absolute;
top: ${theme.spacing.spacing2};
right: ${theme.spacing.spacing2};
z-index: ${theme.dialog.closeBtn.zIndex};
top: ${({ theme }) => theme.spacing('s')};
right: ${({ theme }) => theme.spacing('s')};
z-index: 100;
`;

const StyledDialogHeader = styled(H3)<StyledDialogProps>`
padding: ${({ $size }) => theme.dialog[$size].header.padding};
overflow: hidden;
flex-shrink: 0;
`;
${({ $size, theme }) => theme.dialog.size[$size].header};
const StyledDialogDivider = styled(Divider)<StyledDialogProps>`
margin: ${({ $size }) => `0 ${theme.dialog[$size].divider.marginX} ${theme.dialog[$size].divider.marginBottom}`};
overflow: hidden;
flex-shrink: 0;
`;

const StyledDialogBody = styled(Flex)<StyledDialogProps>`
padding: ${({ $size }) => `${theme.dialog[$size].body.paddingY} ${theme.dialog[$size].body.paddingX}`};
${({ $size, theme }) => theme.dialog.size[$size].body};
flex: 1 1 auto;
`;

const StyledDialogFooter = styled(Flex)<StyledDialogProps>`
padding: ${({ $size }) => theme.dialog[$size].footer.padding};
${({ $size, theme }) => theme.dialog.size[$size].footer};
`;

export { StyledCloseCTA, StyledDialog, StyledDialogBody, StyledDialogDivider, StyledDialogFooter, StyledDialogHeader };
export { StyledCloseCTA, StyledDialog, StyledDialogBody, StyledDialogFooter, StyledDialogHeader };
Loading

0 comments on commit 97c40b4

Please sign in to comment.