Skip to content

Commit

Permalink
Fix typo in z-index interpolation codemod (#1924)
Browse files Browse the repository at this point in the history
<!--
  How to write a good PR title:
- Follow [the Conventional Commits
specification](https://www.conventionalcommits.org/en/v1.0.0/).
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

## Self Checklist

- [x] I wrote a PR title in **English** and added an appropriate
**label** to the PR.
- [x] I wrote the commit message in **English** and to follow [**the
Conventional Commits
specification**](https://www.conventionalcommits.org/en/v1.0.0/).
- [x] I [added the
**changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)
about the changes that needed to be released. (or didn't have to)
- [x] I wrote or updated **documentation** related to the changes. (or
didn't have to)
- [x] I wrote or updated **tests** related to the changes. (or didn't
have to)
- [x] I tested the changes in various browsers. (or didn't have to)
  - Windows: Chrome, Edge, (Optional) Firefox
  - macOS: Chrome, Edge, Safari, (Optional) Firefox

## Related Issue
<!-- Please link to issue if one exists -->

<!-- Fixes #0000 -->

- #1793

## Summary
<!-- Please brief explanation of the changes made -->

- var(--z-index-float) -> var(--z-index-floating) 으로 오타를 수정하고 README에 빠진
내용을 추가합니다.

### Breaking change? (Yes/No)
<!-- If Yes, please describe the impact and migration path for users -->

- No

## References
<!-- Please list any other resources or points the reviewer should be
aware of -->

- None
  • Loading branch information
yangwooseong authored Jan 18, 2024
1 parent 4ea1e5c commit 3080afa
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-garlics-smoke.md
Original file line number Diff line number Diff line change
@@ -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)`.
41 changes: 41 additions & 0 deletions packages/bezier-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`**
Expand Down
2 changes: 1 addition & 1 deletion packages/bezier-codemod/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);',
Expand All @@ -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)',
Expand Down

0 comments on commit 3080afa

Please sign in to comment.