e80c552ae7
Closes https://github.com/twentyhq/core-team-issues/issues/1438 - Reorganized PageLayout module - Created `DashboardRenderer` and `PageLayoutRenderer` - Created stories for the `PageLayoutRenderer` - Refactored the Widget components https://github.com/user-attachments/assets/27e9ac8f-b237-4c21-8494-3fab6d65af3a
35 lines
868 B
TypeScript
35 lines
868 B
TypeScript
import { type GraphColorScheme } from '../types/GraphColorScheme';
|
|
import { calculateAngularGradient } from './calculateAngularGradient';
|
|
|
|
export const createGradientDef = (
|
|
colorScheme: GraphColorScheme,
|
|
id: string,
|
|
isHovered: boolean = false,
|
|
angle?: number,
|
|
reverseGradient: boolean = false,
|
|
) => {
|
|
const colors = isHovered
|
|
? colorScheme.gradient.hover
|
|
: colorScheme.gradient.normal;
|
|
|
|
const coords =
|
|
angle !== undefined
|
|
? calculateAngularGradient(angle)
|
|
: { x1: '0%', y1: '0%', x2: '0%', y2: '100%' };
|
|
|
|
return {
|
|
id,
|
|
type: 'linearGradient' as const,
|
|
...coords,
|
|
colors: reverseGradient
|
|
? [
|
|
{ offset: 0, color: colors[1] },
|
|
{ offset: 100, color: colors[0] },
|
|
]
|
|
: [
|
|
{ offset: 0, color: colors[0] },
|
|
{ offset: 100, color: colors[1] },
|
|
],
|
|
};
|
|
};
|