Skip to content

Commit

Permalink
refactor: Segmented Control 트랜지션에 토큰 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
te6-in committed Jan 9, 2025
1 parent 084f3ca commit 7255ea2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
4 changes: 3 additions & 1 deletion docs/public/rootage/components/segmented-control.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"color": "#0000000d"
}
]
}
},
"transformDuration": "$duration.s4",
"transformTimingFunction": "$timing-function.easing"
}
},
"enabled,pressed": {
Expand Down
20 changes: 20 additions & 0 deletions docs/public/rootage/parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -18939,6 +18939,26 @@
}
]
}
},
{
"key": "transformDuration",
"value": {
"type": "token",
"group": [
"duration"
],
"key": "s4"
}
},
{
"key": "transformTimingFunction",
"value": {
"type": "token",
"group": [
"timing-function"
],
"key": "easing"
}
}
]
}
Expand Down
8 changes: 2 additions & 6 deletions packages/qvism-preset/src/recipes/segmented-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@ const segmentedControl = defineRecipe({

boxShadow: vars.base.enabled.indicator.shadow,

willChange: "left",
// XXX: 임의
transition: "left 0.2s",

left: "var(--seed-design-segmented-control-indicator-left, 0px)",
width: "var(--seed-design-segmented-control-indicator-width, 0px)",
willChange: "transform",
transition: `transform ${vars.base.enabled.indicator.transformDuration} ${vars.base.enabled.indicator.transformTimingFunction}`,
},
},
variants: {},
Expand Down
2 changes: 2 additions & 0 deletions packages/rootage/components/segmented-control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ data:
blur: 6px
spread: 0px
color: "#0000000d"
transformDuration: $duration.s4
transformTimingFunction: $timing-function.easing
enabled,pressed:
segment:
color: $color.bg.neutral-weak-pressed
Expand Down
6 changes: 2 additions & 4 deletions packages/stylesheet/segmentedControl.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
border-radius: var(--seed-v3-radius-full);
background-color: var(--seed-v3-color-bg-layer-default);
box-shadow: 0px 1px 6px 0px #0000000d;
will-change: left;
transition: left 0.2s;
left: var(--seed-design-segmented-control-indicator-left, 0px);
width: var(--seed-design-segmented-control-indicator-width, 0px);
will-change: transform;
transition: transform var(--seed-v3-duration-s4) var(--seed-v3-timing-function-easing);
}
4 changes: 3 additions & 1 deletion packages/vars/lib/component/segmented-control.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export declare const vars: {
"indicator": {
"cornerRadius": "var(--seed-v3-radius-full)",
"color": "var(--seed-v3-color-bg-layer-default)",
"shadow": "0px 1px 6px 0px #0000000d"
"shadow": "0px 1px 6px 0px #0000000d",
"transformDuration": "var(--seed-v3-duration-s4)",
"transformTimingFunction": "var(--seed-v3-timing-function-easing)"
}
},
"enabledPressed": {
Expand Down
4 changes: 3 additions & 1 deletion packages/vars/lib/component/segmented-control.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const vars = {
"indicator": {
"cornerRadius": "var(--seed-v3-radius-full)",
"color": "var(--seed-v3-color-bg-layer-default)",
"shadow": "0px 1px 6px 0px #0000000d"
"shadow": "0px 1px 6px 0px #0000000d",
"transformDuration": "var(--seed-v3-duration-s4)",
"transformTimingFunction": "var(--seed-v3-timing-function-easing)"
}
},
"enabledPressed": {
Expand Down

0 comments on commit 7255ea2

Please sign in to comment.