File tree Expand file tree Collapse file tree 6 files changed +49
-40
lines changed
Expand file tree Collapse file tree 6 files changed +49
-40
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,22 @@ export default meta;
1515type Story = StoryObj < typeof CloudinaryImage > ;
1616
1717export const VersionV3 : Story = {
18- args : {
19- src : 'https://res.cloudinary.com/demo/image/upload/front_face' ,
20- alt : 'front face' ,
21- removeBackground : true ,
22- effects : [ { type : 'sepia' } ] ,
23- resize : { height : 333 } ,
24- format : 'auto' ,
25- quality : 'auto' ,
26- opacity : 100 ,
27- background : { type : 'color' , color : 'white' } ,
28- roundCorners : 0 ,
29- rotate : 0
18+ render : ( ) => {
19+ return (
20+ < CloudinaryImage
21+ src = 'https://res.cloudinary.com/demo/image/upload/front_face'
22+ alt = 'front face'
23+ removeBackground
24+ effects = { [ { type : 'sepia' } ] }
25+ resize = { { height : 333 } }
26+ format = 'auto'
27+ quality = 'auto'
28+ opacity = { 100 }
29+ background = { { type : 'color' , color : 'white' } }
30+ roundCorners = { 0 }
31+ rotate = { 0 }
32+ />
33+ ) ;
3034 }
3135} ;
3236
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import { parseOpacity } from './transformationParsers/parseOpacity';
2424import { Quality } from './transformationTypes/quality' ;
2525import { ImageFormat } from './transformationTypes/format' ;
2626import { RemoveBackground } from './transformationTypes/removeBackground' ;
27- import { Effect } from './transformationTypes/effect' ;
27+ import { ImageEffect } from './transformationTypes/effect' ;
2828import { Background } from './transformationTypes/background' ;
2929import { Rotate } from './transformationTypes/rotate' ;
3030import { RoundCorners } from './transformationTypes/roundCorners' ;
@@ -36,7 +36,7 @@ type ImageTransformationProps = {
3636 quality ?: Quality ;
3737 format ?: ImageFormat ;
3838 removeBackground ?: RemoveBackground ;
39- effects ?: Effect [ ] ;
39+ effects ?: ImageEffect [ ] ;
4040 background ?: Background ;
4141 rotate ?: Rotate ;
4242 roundCorners ?: RoundCorners ;
Original file line number Diff line number Diff line change @@ -20,18 +20,22 @@ export default meta;
2020type Story = StoryObj < typeof CloudinaryVideo > ;
2121
2222export const Version_v3 : Story = {
23- args : {
24- src : 'https://res.cloudinary.com/demo/video/upload/dog.mp4' ,
25- resize : { height : 333 } ,
26- roundCorners : 20 ,
27- duration : '1%' ,
28- startOffset : 0 ,
29- videoCodec : 'h264' ,
30- videoProps : {
31- loop : true ,
32- autoPlay : true ,
33- muted : true
34- }
23+ render : ( ) => {
24+ return (
25+ < CloudinaryVideo
26+ src = 'https://res.cloudinary.com/demo/video/upload/dog.mp4'
27+ videoProps = { {
28+ loop : true ,
29+ autoPlay : true ,
30+ muted : true
31+ } }
32+ resize = { { height : 333 } }
33+ roundCorners = { 20 }
34+ duration = '1%'
35+ startOffset = { 0 }
36+ videoCodec = 'h264'
37+ />
38+ )
3539 }
3640} ;
3741
Original file line number Diff line number Diff line change @@ -32,15 +32,15 @@ import { parseIgnoreAspectRatio } from './transformationParsers/parseIgnoreAspec
3232import { parseZoom } from './transformationParsers/parseZoom' ;
3333import { RemoveBackground } from './transformationTypes/removeBackground' ;
3434import { parseEffects } from './transformationParsers/parseEffects' ;
35- import { Effect } from './transformationTypes/effect' ;
35+ import { VideoEffect } from './transformationTypes/effect' ;
3636import { parseRemoveBackground } from './transformationParsers/parseRemoveBackground' ;
3737import { Resize } from './transformationTypes/resize' ;
3838
3939export type VideoTransformationProps = {
4040 quality ?: Quality ;
4141 format ?: VideoFormat ;
4242 removeBackground ?: RemoveBackground ;
43- effects ?: Effect [ ] ;
43+ effects ?: VideoEffect [ ] ;
4444 background ?: Background ;
4545 rotate ?: Rotate ;
4646 roundCorners ?: RoundCorners ;
Original file line number Diff line number Diff line change 1- import { Effect } from '../transformationTypes/effect' ;
1+ import { AnyEffect } from '../transformationTypes/effect' ;
22import { parseRemoveBackground as ParseRemoveBackground } from './parseRemoveBackground' ;
33
4- export const parseEffects = ( parseRemoveBackground : typeof ParseRemoveBackground ) => ( effects : Effect [ ] ) : string => {
4+ export const parseEffects = ( parseRemoveBackground : typeof ParseRemoveBackground ) => ( effects : AnyEffect [ ] ) : string => {
55 return effects
66 . map ( ( effect ) :`e_${string } ` => {
77 switch ( effect . type ) {
@@ -12,7 +12,7 @@ export const parseEffects = (parseRemoveBackground: typeof ParseRemoveBackground
1212 case 'fade' :
1313 return `e_fade:${ effect . duration } ` ;
1414 case 'gamma' :
15- return `e_gamma:${ effect . duration } ` ;
15+ return `e_gamma:${ effect . level } ` ;
1616 case 'grayscale' :
1717 return 'e_grayscale' ;
1818 case 'light' :
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ type Gamma = {
1919 /**
2020 * @description -50 to 150
2121 */
22- duration : number ;
22+ level : number ;
2323}
2424// FIXME image only
2525type Grayscale = {
@@ -72,20 +72,21 @@ type Auto = {
7272 blendPercentage ?: number ;
7373}
7474
75- type AutoColor = {
76- type : 'autoColor' ;
77-
78- }
79-
80- export type Effect =
75+ export type ImageEffect =
8176 | Sepia
8277 | BackgroundRemoval
83- | Fade
8478 | Gamma
8579 | Grayscale
8680 | Light
8781 | Negate
88- | Noise
8982 | Pixelate
9083 | Blur
9184 | Auto ;
85+
86+ export type VideoEffect =
87+ | Fade
88+ | Gamma
89+ | Noise
90+ | Blur ;
91+
92+ export type AnyEffect = ImageEffect | VideoEffect ;
You can’t perform that action at this time.
0 commit comments