Skip to content

Commit 196043f

Browse files
praneshg239Harness
authored andcommitted
Update canvas zoom interval value and Add sm mode to StudioCard (#10851)
* 420f23 Fix lint issues * 15fe0a Add size variant to StudioCard * 509946 Fix lint issues * 1a2734 Bump UI version * 055844 Update Canvas zoom interval value and Add Small mode to StudioCard
1 parent c1f3d93 commit 196043f

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

packages/pipeline-graph/src/context/canvas-provider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ export const CanvasProvider = ({ children, config: configFromProps, id = '' }: C
134134
}, [])
135135

136136
const increase = useCallback(() => {
137-
scaleInc(0.2)
137+
scaleInc(0.25)
138138
}, [scaleInc])
139139

140140
const decrease = useCallback(() => {
141-
scaleInc(-0.2)
141+
scaleInc(-0.25)
142142
}, [scaleInc])
143143

144144
const reset = useCallback(() => {

packages/ui/src/components/studio-card/studio-card-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface StudioCardRootProps {
1010
// It will be updated to a generic value later
1111
variant?: 'default' | 'stage'
1212
execution?: boolean
13+
size?: 'sm' | 'md'
1314
}
1415

1516
export interface StudioCardHeaderProps {

packages/ui/src/components/studio-card/studio-card.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { PropsWithChildren, useCallback, useMemo, useRef, useState, type JSX } f
22

33
import { IconV2, IconV2NamesType, StatusBadge, Text } from '@/components'
44
import { cn } from '@/utils'
5+
import { cva } from 'class-variance-authority'
56

67
import {
78
StudioCardContentProps,
@@ -19,6 +20,18 @@ import {
1920
* =================
2021
*/
2122

23+
const sizeVariants = cva('', {
24+
variants: {
25+
size: {
26+
sm: 'cn-studio-card-sm',
27+
md: ''
28+
}
29+
},
30+
defaultVariants: {
31+
size: 'md'
32+
}
33+
})
34+
2235
const CLICK_DRAG_THRESHOLD = 5
2336

2437
function Root({
@@ -28,14 +41,15 @@ function Root({
2841
theme = 'default',
2942
selected = false,
3043
variant = 'default',
31-
execution = false
44+
execution = false,
45+
size = 'md'
3246
}: PropsWithChildren<StudioCardRootProps>): JSX.Element {
3347
// Used to determine if a click was a drag or a click
3448
const dragPos = useRef({ x: 0, y: 0 })
3549

3650
return (
3751
<div
38-
className={cn('cn-studio-card cursor-default', {
52+
className={cn('cn-studio-card cursor-default', sizeVariants({ size }), {
3953
'cn-studio-card-execution': execution,
4054
'cn-studio-card-group': isGroupCard,
4155
'cn-studio-card-stage': variant === 'stage'

packages/ui/tailwind-utils-config/components/studio-card.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export default {
3636
maxWidth: '220px',
3737
height: 'var(--cn-size-40)',
3838

39+
'&.cn-studio-card-sm': {
40+
borderWidth: '2px !important',
41+
},
42+
3943
// Selected state with theme-based borders
4044
'&[data-selected="true"]': {
4145
'&[data-theme="default"]': {

0 commit comments

Comments
 (0)