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

feat: add checkbox #140

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/_includes/partials/components/checkbox.macro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{%- macro checkbox(params) -%}
<div>
<input class="checkbox" type="checkbox" id="{{ params.id }}" name="{{ params.name }}">
<label for="{{ params.id }}">{{ params.label }}</label>
</div>
{% endmacro %}
greatislander marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions src/assets/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@import "./components/_navigation.css";
@import "./components/_card.css";
@import "./components/_project-panel.css";
@import "./components/_checkbox.css";

/* Collections */
@import "./collections/_announcements.css";
Expand Down
58 changes: 58 additions & 0 deletions src/assets/styles/components/_checkbox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* Custom checkboxes. Reference: https://codepen.io/spacemonkey/pen/vmZROv */
.checkbox {
greatislander marked this conversation as resolved.
Show resolved Hide resolved
opacity: 0;
position: absolute;
}

.checkbox + label {
cursor: pointer;
display: flex;
padding: 0;
position: relative;
}

/* Box */
.checkbox + label::before {
block-size: 1.25rem;
border: 0.0625rem solid var(--fl-fgColor, var(--color-indigo-700));
border-radius: 0.1875rem;
content: "";
display: inline-block;
inline-size: 1.25rem;
margin-block: auto;
margin-inline: 0 0.625rem;
vertical-align: text-top;
}

/* Checkmark */
.checkbox:checked + label::after {
block-size: 0.125rem;
color: var(--fl-fgColor, var(--color-indigo-700));
content: "\2713";
display: inline-block;
font-family: system-ui;
font-size: var(--step-0);
inline-size: 0.125rem;
left: 0.125rem;
position: absolute;
top: -0.125rem;
}

.checkbox:active + label::after {
color: var(--fl-bgColor, var(--color-white));
}

.checkbox:active + label::before {
background-color: var(--fl-fgColor, var(--color-indigo-700));
}

.checkbox:focus + label::before {
border: 0.0625rem solid var(--fl-fgColor, var(--color-indigo-700));
box-shadow:
0 0 0 0.125rem var(--fl-bgColor, #fff),
0 0 0 0.25rem var(--fl-fgColor, var(--color-indigo-700));
}

.checkbox:hover + label::before {
border: 0.1875rem solid var(--fl-fgColor, var(--color-indigo-700));
}
Loading