From 71fb1b8645e189790f95c6fb7e94feb7cecffba8 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 17 Jan 2024 11:03:16 +0900 Subject: [PATCH 1/3] feat(codemod): typo fix in z-index transform --- packages/bezier-codemod/src/App.tsx | 2 +- .../fixtures/z-index-enum.output.tsx | 2 +- .../z-index-interpolation-in-styled-component.output.tsx | 2 +- .../v2-z-index-interpolation-to-css-variable/transform.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/bezier-codemod/src/App.tsx b/packages/bezier-codemod/src/App.tsx index 8bf2f48e0e..caaea61a34 100644 --- a/packages/bezier-codemod/src/App.tsx +++ b/packages/bezier-codemod/src/App.tsx @@ -55,8 +55,8 @@ enum Option { V2FoundationToCssVariable = 'v2-foundation-to-css-variable', V2InputInterpolationToCssVariable = 'v2-input-interpolation-to-css-variable', V2TypographyInterpolationToCssVariable = 'v2-typography-interpolation-to-css-variable', - V2RemoveAlphaFromAlphaComponents = 'v2-remove-alpha-from-alpha-components', V2ZIndexInterpolationToCssVariable = 'v2-z-index-interpolation-to-css-variable', + V2RemoveAlphaFromAlphaComponents = 'v2-remove-alpha-from-alpha-components', V2TextComponentInterface = 'v2-text-component-interface', V2ImportFromBezierToStyledComponents = 'v2-import-from-bezier-to-styled-components', Exit = 'Exit', diff --git a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-enum.output.tsx b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-enum.output.tsx index 1ccb0e9e55..a1eeb10d70 100644 --- a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-enum.output.tsx +++ b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-enum.output.tsx @@ -4,7 +4,7 @@ export const OVERLAY_POSITION1 = { } export const OVERLAY_POSITION2 = { - zIndex: 'var(--z-index-float)', + zIndex: 'var(--z-index-floating)', } export const OVERLAY_POSITION3 = { diff --git a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-interpolation-in-styled-component.output.tsx b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-interpolation-in-styled-component.output.tsx index 598105c81f..bd4e488bd4 100644 --- a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-interpolation-in-styled-component.output.tsx +++ b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/fixtures/z-index-interpolation-in-styled-component.output.tsx @@ -9,7 +9,7 @@ const Wrapper = styled.div` ` const Wrapper = styled.div` - z-index: var(--z-index-float); + z-index: var(--z-index-floating); ` const Wrapper = styled.div` diff --git a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/transform.ts b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/transform.ts index e937c4f1ff..dcdd60ae26 100644 --- a/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/transform.ts +++ b/packages/bezier-codemod/src/transforms/v2-z-index-interpolation-to-css-variable/transform.ts @@ -9,7 +9,7 @@ const CSS_VARIABLE_TRANSFORM_MAP = { 'ZIndex.Hide': 'var(--z-index-hidden);', 'ZIndex.Auto': 'var(--z-index-auto);', 'ZIndex.Base': 'var(--z-index-base);', - 'ZIndex.Float': 'var(--z-index-float);', + 'ZIndex.Float': 'var(--z-index-floating);', 'ZIndex.Overlay': 'var(--z-index-overlay);', 'ZIndex.Modal': 'var(--z-index-modal);', 'ZIndex.Toast': 'var(--z-index-toast);', @@ -21,7 +21,7 @@ const ENUM_TRANSFORM_MAP = { ZIndex: { Hide: 'var(--z-index-hidden)', Base: 'var(--z-index-base)', - Float: 'var(--z-index-float)', + Float: 'var(--z-index-floating)', Overlay: 'var(--z-index-overlay)', Modal: 'var(--z-index-modal)', Toast: 'var(--z-index-toast)', From 0312602d888e24fd8e00889f97bd29b96d4ea217 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 17 Jan 2024 11:03:42 +0900 Subject: [PATCH 2/3] feat(codemod): add missed z-index transform document in README --- packages/bezier-codemod/README.md | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/bezier-codemod/README.md b/packages/bezier-codemod/README.md index 820c43f8cf..f84fd4c0ec 100644 --- a/packages/bezier-codemod/README.md +++ b/packages/bezier-codemod/README.md @@ -207,6 +207,47 @@ const Wrapper = styled.div` `; ``` +**`v2-z-index-interpolation-to-css-variable`** + +Replace z-index interpolation and z-index enum with css variable +For example: + +```tsx +import { ZIndex, styled } from "@channel.io/bezier-react"; + +const Wrapper = styled.div` + z-index: ${ZIndex.Hide}; +`; +``` + +Transforms into: + +```tsx +import { styled } from "@channel.io/bezier-react"; + +const Wrapper = styled.div` + z-index: var(--z-index-hidden); +`; +``` + +Also, + +```tsx +import { ZIndex } from "@channel.io/bezier-react"; + +export const OVERLAY_POSITION1 = { + zIndex: ZIndex.Modal, +}; +``` + +Transforms into: + +```tsx +export const OVERLAY_POSITION1 = { + zIndex: "var(--z-index-modal)", +}; +``` + ### import directly from styled-components **`v2-import-from-bezier-to-styled-components`** From 1aa210c6b473080cda9aef2460a22bfdd492001d Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 17 Jan 2024 11:06:25 +0900 Subject: [PATCH 3/3] chore(changeset): add changeset for minor version bump --- .changeset/early-garlics-smoke.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/early-garlics-smoke.md diff --git a/.changeset/early-garlics-smoke.md b/.changeset/early-garlics-smoke.md new file mode 100644 index 0000000000..ecc8eebec9 --- /dev/null +++ b/.changeset/early-garlics-smoke.md @@ -0,0 +1,5 @@ +--- +"@channel.io/bezier-codemod": minor +--- + +Fix typo in `v2-z-index-interpolation-to-css-variable` codemod. It now transforms `${ZIndex.Float}` enum to `var(--z-index-floating)`, not `var(--z-index-float)`.