Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use an extra empty div for styling, when the same effect can be achieved with using CSS on pre-existing element #111

Open
sophie-cluml opened this issue Jul 1, 2024 · 2 comments
Assignees

Comments

@sophie-cluml
Copy link
Contributor

Background

#98 (comment)

Expected result

현재 코드 상, 다음과 같은 AS-IS 코드가 있다면 TO-BE 코드와 같은 모습으로 변경되도록 합니다.

  • AS-IS
<div class="some-box">
...
</div>
<div class="divider"></div>

<style>
.divider {
  border: 1px solid #000;
 }
</style>
  • TO-BE
<div class="some-box">
...
</div>

<style>
.some-box {
  border-bottom: 1px solid #000;
}
</style>
@sophie-cluml sophie-cluml changed the title Do not use an extra empty div for styling, when the same effect can be achieved with CSS on pre-existing element Do not use an extra empty div for styling, when the same effect can be achieved with using CSS on pre-existing element Jul 1, 2024
@sophie-cluml
Copy link
Contributor Author

@div-seungha 제가 이슈를 대신 생성하였습니다. 이슈를 해결하는 데에 더 도움이 되는 내용이 있다면 추가해주시면 감사하겠습니다.

@sehkone
Copy link
Contributor

sehkone commented Jul 1, 2024

내용이 없는 <div class="space"></div>는 정적으로 사용되기 보다는 동적으로 사용되고 있을 것입니다.

즉, AS-IS는 아래와 같습니다.

...
    <div class="some-box">
        ...
    </div>
    {
        if condition {
            html! {
                <div class="space">
                </div>
            }
        }
    }
...

TO-BE는 아래처럼 해야합니다.

...
    let class = if condition {
        "some-box-with-space"
    } else {
        "some-box"
    };
    html! {
        <div {class}>
            ...
        </div>
    }
...

CSS에는 아래처럼 되어야 합니다.

.some-box {
    ...
}
.some-box-with-space {
    ...
}

@div-seungha div-seungha self-assigned this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants