Skip to content

Commit

Permalink
Merge pull request #73 from SySagar/dev
Browse files Browse the repository at this point in the history
fix[button,typography]: stlyes and variants
  • Loading branch information
SySagar authored Oct 29, 2024
2 parents de46c2d + bc83ba8 commit bc46f7d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-coats-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@groovy-box/ui': patch
---

button tialwind clashes and typography variants
2 changes: 1 addition & 1 deletion apps/ui/lib/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
const Comp = asChild ? Slot : 'button';
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
className={cn(buttonVariants({ variant, size }), className)}
ref={ref}
{...props}
/>
Expand Down
6 changes: 0 additions & 6 deletions apps/ui/lib/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { cn } from '@utils/utils';
export interface TextProps extends React.HTMLAttributes<HTMLParagraphElement> {
variant?: keyof typeof VARIANT_MAPPINGS;
alignment?: 'left' | 'right' | 'center' | 'justify';
color?: string;
width?: number;
maxLines?: number;
asChild?: boolean;
children: React.ReactNode;
Expand All @@ -16,22 +14,18 @@ export interface TextProps extends React.HTMLAttributes<HTMLParagraphElement> {
export const Text: React.FC<TextProps> = ({
variant,
alignment,
color,
width,
maxLines,
asChild = false,
children,
...props
}) => {
const textStyle = {
textAlign: alignment || 'center',
color: color,
margin: '0 0 0 0',
padding: '0 0 0 0',
display: asChild ? 'inline-block' : 'block',
textOverflow: 'ellipsis',
overflow: 'hidden',
width: width || 'inherit',
WebkitLineClamp: maxLines || 'inherit',
};

Expand Down
2 changes: 1 addition & 1 deletion apps/ui/lib/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
--text-secondary: 30, 30, 30;

--accent: 0, 0, 0;
--background-paper: white;
--background-paper: 255 255 255;
--background-opacity: 0, 0, 0, 0.05;
}

Expand Down
8 changes: 8 additions & 0 deletions apps/ui/stories/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export const tailwindButton = () => {
return <Button className="bg-warning-500 text-secondaryText">Hello</Button>;
};

export const tailwindButtonWithOverridingVariant = () => {
return (
<Button variant={'outline'} className="grv-bg-[#ff0f] grv-outline-[#1fa]">
Hello
</Button>
);
};

export const Sizes = () => (
<div
style={{
Expand Down
20 changes: 4 additions & 16 deletions apps/ui/stories/Toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, Story } from '@storybook/react';
import { withGlobalStyles } from '../.storybook/decorator';
import { useToast, Button, Toaster, ToastAction } from '../lib';

const DefaultTemplate = () => {
export const Default = () => {
const { toast } = useToast();
return (
<div
Expand Down Expand Up @@ -31,15 +31,11 @@ const DefaultTemplate = () => {

export default {
title: 'components/Toast',
component: DefaultTemplate,
component: Default,
decorators: [withGlobalStyles],
} as Meta;

export const Default = () => {
return <DefaultTemplate />;
};

const DestructiveTemplate = () => {
export const Destructive = () => {
const { toast } = useToast();
return (
<div
Expand All @@ -66,11 +62,7 @@ const DestructiveTemplate = () => {
);
};

export const Destructive = () => {
return <DestructiveTemplate />;
};

const DestructiveTemplateWithActionButton = () => {
export const DestructiveWithActionButton = () => {
const { toast } = useToast();
return (
<div
Expand All @@ -97,7 +89,3 @@ const DestructiveTemplateWithActionButton = () => {
</div>
);
};

export const DestructiveWithActionButton = () => {
return <DestructiveTemplateWithActionButton />;
};
13 changes: 13 additions & 0 deletions apps/ui/stories/Typography.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ export const withTailwindAndVariant = () => {
);
};

export const withTailwindAndVariant2 = () => {
return (
<div style={{ marginBottom: '20px' }}>
<Text
variant="heading-1"
className="grv-text-[#a0c] grv-text-[10px] grv-font-light"
>
with tailwind classes and variant
</Text>
</div>
);
};

// Alignment Center
export const AlignmentCenterStory = Template.bind({});
AlignmentCenterStory.args = {
Expand Down

0 comments on commit bc46f7d

Please sign in to comment.