Skip to content

Commit

Permalink
fix(core): apply correct padding
Browse files Browse the repository at this point in the history
move css to card-body, can not work if multiple card are nested

fixes: #36
  • Loading branch information
Sukaato committed Sep 18, 2024
1 parent a87fb3d commit 47a6613
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/components/card-body/card-body.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
flex-grow: 1;
}
}

:host-context(pop-card[compact]) {
--padding: 16px;
}
52 changes: 52 additions & 0 deletions packages/core/src/components/card-body/tests/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Basic | Poppy-ui</title>
<link rel="stylesheet" href="/build/poppy.css">
<script type="module" src="/build/poppy.esm.js"></script>
<script nomodule src="/build/poppy.js"></script>
<style>
main {
width: 100vw;
height: 100dvh;
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;

background-color: var(--base-100);
}
section {
display: flex;
flex-direction: column;
justify-content: center;
gap: .35rem;
}
pop-card {
background-color: var(--base-300);
}
</style>
</head>
<body>
<main>
<section>
<h2>Card - basic</h2>
<pop-card>
<pop-card-body>
content
</pop-card-body>
</pop-card>
</section>
<section>
<h2>Card - compact</h2>
<pop-card compact>
<pop-card-body>
content
</pop-card-body>
</pop-card>
</section>
</main>
</body>
</html>
6 changes: 0 additions & 6 deletions packages/core/src/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@
background-color: var(--background);
color: var(--color);
}

:host([compact]) {
:where(pop-card-body) {
--padding: 16px;
}
}

0 comments on commit 47a6613

Please sign in to comment.