Skip to content

Commit

Permalink
feat: add modal component
Browse files Browse the repository at this point in the history
  • Loading branch information
matifandy8 committed Oct 23, 2023
1 parent 076ee58 commit 10aef91
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 10 deletions.
65 changes: 61 additions & 4 deletions dist/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -602,13 +602,14 @@ html {
.card {
width: 300px;
margin: 20px;
border: 2px solid #000;
border-radius: 8px;
overflow: hidden;
transition: box-shadow 0.2s ease, transform 0.3s ease; }
border: 3px solid #000;
box-shadow: -3px 3px 0px #000000;
transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card:hover {
box-shadow: 3px 3px 0px #000000;
transform: translate(-6px, -6px); }
box-shadow: 0px 0px 0px #000000;
transform: translate(-6px, 6px); }

.card a {
margin: 0;
Expand Down Expand Up @@ -701,3 +702,59 @@ input.nb-checkbox {
color: #031926;
padding: 10px;
margin: 0; }

input[type="checkbox"] {
display: none; }

input[type="checkbox"]:checked ~ .modal,
input[type="checkbox"]:checked ~ .modal-background {
display: block; }

.modal-background {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
display: none;
z-index: 9998; }

.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
display: none;
width: 300px;
height: 300px;
background-color: #fff;
box-sizing: border-box;
z-index: 9999; }
.modal > p {
padding: 15px;
margin: 0; }
.modal-header {
background-color: #f9f9f9;
border-bottom: 1px solid #dddddd;
box-sizing: border-box;
height: 50px; }
.modal-header h3 {
margin: 0;
box-sizing: border-box;
padding-left: 15px;
line-height: 50px;
color: #4d4d4d;
font-size: 16px;
display: inline-block; }
.modal-header label {
box-sizing: border-box;
border-left: 1px solid #dddddd;
float: right;
line-height: 50px;
padding: 0 15px 0 15px;
cursor: pointer; }
.modal-header label:hover img {
opacity: 0.6; }
2 changes: 1 addition & 1 deletion dist/index.min.css

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,27 @@ <h3>Avatar</h3>
</code>
</pre>
</figure>
</section>
<section class="sections">
<h3>Modal</h3>
<p class="component-description">
Section demonstrates a modal component provided by NeoBrutalismCSS.
</p>
<input type="checkbox" id="modal">
<label for="modal" class="nb-button rounded green">Open Modal</label>
<label for="modal" class="modal-background"></label>
<div class="modal dialog">
<div class="modal-header">
<h3>Modal Title</h3>
<label for="modal">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAdVBMVEUAAABNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU0N3NIOAAAAJnRSTlMAAQIDBAUGBwgRFRYZGiEjQ3l7hYaqtLm8vsDFx87a4uvv8fP1+bbY9ZEAAAB8SURBVBhXXY5LFoJAAMOCIP4VBRXEv5j7H9HFDOizu2TRFljedgCQHeocWHVaAWStXnKyl2oVWI+kd1XLvFV1D7Ng3qrWKYMZ+MdEhk3gbhw59KvlH0eTnf2mgiRwvQ7NW6aqNmncukKhnvo/zzlQ2PR/HgsAJkncH6XwAcr0FUY5BVeFAAAAAElFTkSuQmCC"
width="16" height="16" alt="">
</label>
</div>
<p>Content for the modal</p>
</div>


</section>
<section class="sections backgrounds">
<h3>Colors</h3>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neobrutalismcss",
"version": "0.1.5",
"version": "0.2.5",
"description": "NeoBrutalismCSS design framework that embraces the aesthetics of neo-brutalism in web",
"main": "dist/index.min.css",
"repository": {
Expand Down
9 changes: 5 additions & 4 deletions src/scss/components/_cards.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.card {
width: 300px;
margin: 20px;
border: 2px solid #000;
border-radius: 8px;
overflow: hidden;
transition: box-shadow 0.2s ease, transform 0.3s ease;
border: 3px solid #000;
box-shadow: -3px 3px 0px #000000;
transition: box-shadow 0.2s ease, transform 0.2s ease;
&:hover {
box-shadow: 3px 3px 0px #000000;
transform: translate(-6px, -6px);
box-shadow: 0px 0px 0px #000000;
transform: translate(-6px, 6px);
}
}

Expand Down
71 changes: 71 additions & 0 deletions src/scss/components/_modal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
input[type="checkbox"] {
display: none;
}

input[type="checkbox"]:checked ~ .modal,
input[type="checkbox"]:checked ~ .modal-background {
display: block;
}

.modal-background {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
display: none;
z-index: 9998;
}

.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
display: none;
width: 300px;
height: 300px;
background-color: #fff;
box-sizing: border-box;
z-index: 9999;

> p {
padding: 15px;
margin: 0;
}

&-header {
background-color: #f9f9f9;
border-bottom: 1px solid #dddddd;
box-sizing: border-box;
height: 50px;

h3 {
margin: 0;
box-sizing: border-box;
padding-left: 15px;
line-height: 50px;
color: #4d4d4d;
font-size: 16px;
display: inline-block;
}

label {
box-sizing: border-box;
border-left: 1px solid #dddddd;
float: right;
line-height: 50px;
padding: 0 15px 0 15px;
cursor: pointer;

&:hover {
img {
opacity: 0.6;
}
}
}
}
}
1 change: 1 addition & 0 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
@import "components/avatar";
@import "components/checkbox";
@import "components/badge";
@import "components/modal";

0 comments on commit 10aef91

Please sign in to comment.