Skip to content

Commit

Permalink
feat: add promare gradient component (#876)
Browse files Browse the repository at this point in the history
Signed-off-by: hxtree <[email protected]>
  • Loading branch information
hxtree authored Mar 27, 2024
1 parent 792ccfa commit 2b3142a
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 128 deletions.
3 changes: 2 additions & 1 deletion clients/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"bootstrap": "~5.3.2",
"@popperjs/core": "2.11.8",
"@rollup/plugin-multi-entry": "~6.0.1",
"xss": "~1.0.14"
"xss": "~1.0.14",
"@cats-cradle/promare-gradients": "workspace:*"
},
"devDependencies": {
"@types/react-modal": "3.16.3",
Expand Down
22 changes: 22 additions & 0 deletions clients/design-system/src/components/Gradient/Gradient.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { GradientVariant } from './GradientVariant.enum';
import '@cats-cradle/promare-gradients/dist/css/promare-gradients.css';

export interface GradientProps {
variant: GradientVariant;
children?: React.ReactNode;
}

export const Gradient = (props: GradientProps) => {
const { variant, children } = props;

const classNames = [];

classNames.push(variant.toString())

return (
<div className={classNames.join(' ')}>
{children}
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum GradientVariant {
BG_BLUE_TO_LIME_75_NW = 'bg-blue-to-lime-75-nw',
BG_PLASTIC_75_TO_GRAYSCALE_0_SE = 'bg-plastic-75-to-grayscale-0-se',
}
1 change: 1 addition & 0 deletions clients/design-system/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export * from './Images/Images';
export * from './BlurbPair/BlurbPair';
export * from './Tabs/Tabs';
export * from './Tabs/Tabs.type';
export * from './Gradient/Gradient';
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { Meta } from '@storybook/react';
import { Gradient, GradientProps } from '../../../src/main';
import { GradientVariant } from '../../../src/components/Gradient/GradientVariant.enum';

export default {
title: 'Atoms/Gradient',
component: Gradient,
argTypes: {
variant: {
options: Object.values(GradientVariant),
mapping: Object.values(GradientVariant),
control: {
type: 'select',
labels: Object.keys(GradientVariant),
},
},
},
} as Meta<typeof Gradient>;

export const Default = (args: GradientProps) =>
<Gradient {...args}>
Sample Content
</Gradient>;

Default.args = {
variant: GradientVariant.BG_BLUE_TO_LIME_75_NW,
} as GradientProps;
4 changes: 4 additions & 0 deletions common/config/rush/browser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
"name": "@cats-cradle/nestjs-modules",
"allowedCategories": [ "apis", "rigs" ]
},
{
"name": "@cats-cradle/promare-gradients",
"allowedCategories": [ "clients" ]
},
{
"name": "@cats-cradle/validation-decorators",
"allowedCategories": [ "apis" ]
Expand Down
Loading

0 comments on commit 2b3142a

Please sign in to comment.