Skip to content
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
11 changes: 11 additions & 0 deletions platforms/metagram/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,19 @@
--color-black-200: #d2d2d2;

--color-grey: #f5f5f5;
--color-gray-500: #C0C0C0;

--color-brand-burnt-orange: #da4a11;
--color-brand-burnt-orange-100 #F8DBCF;
--color-brand-burnt-orange-200: #F3C3B0;
--color-brand-burnt-orange-300: #ECA488;
--color-brand-burnt-orange-400: #E68660;
--color-brand-burnt-orange-500: #E06839;
--color-brand-burnt-orange-600: #91310B;
--color-brand-burnt-orange-700: #6D2509;
--color-brand-burnt-orange-800: #491906;
--color-brand-burnt-orange-900: #2C0F03;

--color-brand-gradient: linear-gradient(
91.82deg,
#4d44ef -36.17%,
Expand Down
11 changes: 11 additions & 0 deletions platforms/metagram/src/lib/ui/Button/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ export const Primary = {
args: { variant: 'primary', children: ButtonText }
};

export const Secondary = {
args: {
variant: 'secondary',
blockingClick: true,
children: ButtonText,
callback: async () => {
await new Promise((resolve) => setTimeout(resolve, 2000));
}
}
};

export const Danger = {
args: { variant: 'danger', children: ButtonText }
};
Expand Down
10 changes: 8 additions & 2 deletions platforms/metagram/src/lib/ui/Button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { HTMLButtonAttributes } from 'svelte/elements';
interface IButtonProps extends HTMLButtonAttributes {
variant?: 'primary' | 'danger';
variant?: 'primary' |'secondary' | 'danger';
isLoading?: boolean;
callback?: () => Promise<void> | void;
blockingClick?: boolean;
Expand Down Expand Up @@ -39,12 +39,14 @@
};
const variantClasses = {
primary: { background: 'bg-grey', text: 'text-black-800' },
primary: { background: 'bg-grey', text: 'text-black-800', border: "border border-grey-500" },
secondary: { background: 'bg-brand-burnt-orange', text: 'text-white'},
danger: { background: 'bg-red-500', text: 'text-white' }
};
const disabledVariantClasses = {
primary: { background: 'bg-grey/50', text: 'text-black-800/50' },
secondary: { background: 'bg-brand-burnt-orange/50', text: 'text-white/50'},
danger: { background: 'bg-red-500/50', text: 'text-white/50' }
};
Expand All @@ -64,6 +66,9 @@
text: disabled
? disabledVariantClasses[variant].text || variantClasses[variant].text
: variantClasses[variant].text,
border: disabled
? disabledVariantClasses[variant].border || variantClasses[variant].border
: variantClasses[variant].border,
disabled: 'cursor-not-allowed'
});
</script>
Expand All @@ -75,6 +80,7 @@
classes.common,
classes.background,
classes.text,
classes.border,
disabled && classes.disabled,
restProps.class
].join(' ')
Expand Down
Loading