mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-24 08:18:41 -05:00
32aafbcf9d
* Implement components
* fix
* revert
* wip
* wip
* wip
* 🎉 Finish create component operation
* minor fixes
* not needed, refactor
* refactor not needed
* refactor not needed
* remove deps
* add changelog
* fixes
* fixes
* fixes
* fix lint
* refactor ui-src
* further refactor
* refactor
* refactor
* more refactor
* refactor
* refactor
* penpot lib update
---------
Co-authored-by: Alex Sánchez <sion333@gmail.com>
Co-authored-by: Andrés Moya <andres.moya@kaleidos.net>
31 lines
750 B
TypeScript
31 lines
750 B
TypeScript
import { Fill } from '@ui/lib/types/utils/fill';
|
|
import { Gradient, LINEAR_TYPE, RADIAL_TYPE } from '@ui/lib/types/utils/gradient';
|
|
|
|
export const symbolFillGradients = (fills?: Fill[]): Fill[] | undefined => {
|
|
if (!fills) return;
|
|
|
|
return fills.map(fill => {
|
|
if (fill.fillColorGradient) {
|
|
fill.fillColorGradient = symbolFillGradient(fill.fillColorGradient);
|
|
}
|
|
|
|
return fill;
|
|
});
|
|
};
|
|
|
|
const symbolFillGradient = ({ type, ...rest }: Gradient): Gradient | undefined => {
|
|
switch (type) {
|
|
case 'linear':
|
|
return {
|
|
type: LINEAR_TYPE,
|
|
...rest
|
|
};
|
|
case 'radial':
|
|
return {
|
|
type: RADIAL_TYPE,
|
|
...rest
|
|
};
|
|
}
|
|
|
|
console.error(`Unsupported gradient type: ${String(type)}`);
|
|
};
|