Skip to content

Commit

Permalink
💄 No section full height in mobile + fix Safari (#432, #442)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jan 26, 2022
1 parent 5f8a83f commit 33b132c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 49 deletions.
89 changes: 42 additions & 47 deletions src/components/LinkItems/Collapsable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default {
methods: {
/* Check that row & column span is valid, and not over the max */
checkSpanNum(span, classPrefix) {
const maxSpan = 5;
const maxSpan = 6;
let numSpan = /^\d*$/.test(span) ? parseInt(span, 10) : 1;
numSpan = (numSpan > maxSpan) ? maxSpan : numSpan;
return `${classPrefix}-${numSpan}`;
Expand Down Expand Up @@ -142,43 +142,36 @@ export default {
@import '@/styles/media-queries.scss';
.collapsable {
padding: var(--item-group-padding);
width: 100%;
width: stretch;
height: fit-content;
margin: 10px;
padding: var(--item-group-padding);
border-radius: var(--curve-factor);
background: var(--item-group-outer-background);
box-shadow: var(--item-group-shadow);
height: fit-content;
width: 100%;
width: stretch;
background: var(--item-group-outer-background);
/* Options allowing sections to SPAN multiple rows or columns */
grid-row-start: span 1;
&.row-2 { grid-row-start: span 2; }
&.row-3 { grid-row-start: span 3; }
&.row-4 { grid-row-start: span 4; }
&.row-5 { grid-row-start: span 5; }
&.row-6 { grid-row-start: span 6; }
grid-column-start: span 1;
@include tablet-up {
&.col-2 { grid-column-start: span 2; }
&.col-3 { grid-column-start: span 2; }
&.col-4 { grid-column-start: span 2; }
&.col-5 { grid-column-start: span 2; }
&.col-2, &.col-3, &.col-4, &.col-5, &.col-6 { grid-column-start: span 2; }
}
@include laptop-up {
&.col-2 { grid-column-start: span 2; }
&.col-3 { grid-column-start: span 3; }
&.col-4 { grid-column-start: span 3; }
&.col-5 { grid-column-start: span 3; }
&.col-3, &.col-4, &.col-5, &.col-6 { grid-column-start: span 3; }
}
@include monitor-up {
&.col-2 { grid-column-start: span 2; }
&.col-3 { grid-column-start: span 3; }
&.col-4 { grid-column-start: span 4; }
&.col-5 { grid-column-start: span 5; }
}
.wrap-collabsible {
margin-bottom: 1.2rem 0;
&.col-6 { grid-column-start: span 6; }
}
input[type='checkbox'] {
Expand All @@ -203,25 +196,23 @@ export default {
display: inline;
margin-right: 0.5rem;
}
&:hover {
color: var(--item-group-heading-text-color-hover);
}
&::before {
content: ' ';
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: .7rem;
transform: translateY(-2px);
transition: transform .2s ease-out;
}
}
.lbl-toggle:hover {
color: var(--item-group-heading-text-color-hover);
}
.lbl-toggle::before {
content: ' ';
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: .7rem;
transform: translateY(-2px);
transition: transform .2s ease-out;
}
.toggle:checked + .lbl-toggle::before {
input.toggle:checked + .lbl-toggle::before {
transform: rotate(90deg) translateX(-3px);
}
Expand All @@ -233,11 +224,11 @@ export default {
border-radius: 0 0 var(--curve-factor) var(--curve-factor);
}
.toggle:checked + .lbl-toggle + .collapsible-content {
max-height: 3000px;
input.toggle:checked + .lbl-toggle + .collapsible-content {
max-height: var(--section-max-height);
}
.toggle:checked + .lbl-toggle {
input.toggle:checked + .lbl-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
Expand All @@ -246,22 +237,26 @@ export default {
padding: 0.5rem;
}
/* Section edit button, shown when in edit mode */
.edit-mode-item {
width: 1rem;
height: 1rem;
float: right;
right: 0.5rem;
top: 0.5rem;
}
// Makes sections fill available space
&.is-open.full-height {
height: -webkit-fill-available;
display: flex;
flex-direction: column;
align-items: normal;
.collapsible-content {
height: -webkit-fill-available;
width: 100%;
/* Makes sections fill available space */
@include phone-up {
&.is-open.full-height {
height: auto;
display: flex;
align-items: normal;
flex-direction: column;
.collapsible-content {
width: 100%;
height: 100%;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/styles/dimensions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
--item-icon-transform-hover: drop-shadow(4px 8px 3px var(--transparent-50)) saturate(2);
--item-group-shadow: var(--item-shadow);
--context-menu-shadow: var(--item-shadow);
--section-max-height: 3000px;

/* Settings and config menu */
--settings-container-shadow: none;
Expand All @@ -30,4 +31,4 @@
--tooltip-arrow-size: 6px;
--tooltip-width: 250px;
--tooltip-padding: 0.2rem;
}
}
14 changes: 13 additions & 1 deletion src/styles/media-queries.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ $extra-large: 2800px;
}
}

@mixin phone-up {
@media (min-width: #{$tiny}) {
@content;
}
}
@mixin tablet-up {
@media (min-width: #{$small}) {
@content;
Expand All @@ -70,4 +75,11 @@ $extra-large: 2800px;
@media (max-width: #{$small - 1px}) {
@content;
}
}
}

@mixin safari {
_::-webkit-full-page-media, _:future, :root .safari_only {
@content;
}
}

0 comments on commit 33b132c

Please sign in to comment.