Penar Musaraj 7140517ec8
DEV: Fix SCSS deprecations (#172)
* DEV: Fix SCSS deprecations

Followup to https://github.com/discourse/discourse-subscriptions/pull/171

Also fixes:

```
    ╷
581 │       hsl(random(360), 100, 50);
    │       ^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
    /Users/pmusaraj/Projects/discourse/discourse-subscriptions.scss 581:7  root stylesheet
Deprecation Warning: $lightness: Passing a number without unit % (50) is deprecated.
```

* More cleanup
2023-07-19 11:15:34 -04:00

451 lines
9.8 KiB
SCSS

.subscription-campaign-sidebar {
#main-outlet
.container.list-container
.row:nth-of-type(2)
.full-width
#list-area
.contents {
display: grid;
grid-template-columns: 78% calc(22% - 2em);
grid-template-areas: "content sidebar";
grid-column-gap: 2em;
span:first-of-type {
grid-area: sidebar;
}
}
}
// All
.campaign-banner {
box-shadow: 5px 5px
var(--discourse_subscriptions_campaign_banner_shadow_color);
}
// Sidebar Version
.subscriptions-campaign-sidebar .campaign-banner {
width: 100%;
flex-direction: column;
position: relative;
.btn.close {
position: absolute;
top: 1em;
right: 1em;
font-size: 10px;
z-index: 1;
}
.campaign-banner-info {
display: flex;
flex-direction: column;
align-items: center;
width: calc(100% - 2em);
padding: 1em 1em 2em 1em;
position: relative;
&-header {
font-size: $font-up-5;
margin: 0 !important;
text-align: center;
}
&-description {
width: 100%;
font-size: $font-down-1;
text-align: center;
margin-bottom: 1em;
}
}
.campaign-banner-progress {
width: calc(100% - 2em);
margin: 1em 0;
padding: 1em;
&-users {
align-items: stretch;
display: flex;
flex-direction: column;
margin: 0;
&-title {
font-size: $font-down-1;
strong {
font-weight: bold;
}
}
}
}
.campaign-banner-info-button {
height: 2em;
}
progress[value] {
height: 1.5em;
}
.campaign-banner-progress-description {
font-size: $font-down-1;
}
}
// Hide from showing above main container outlet
// on topic list
body.archetype-regular {
.above-main-container-outlet.subscriptions-campaign {
display: none;
}
}
// Above Topic List version
.campaign-banner {
display: flex;
width: 100%;
margin: 1em 0 2em 0;
border: 1px solid var(--primary-low);
position: relative;
align-items: stretch;
@media screen and (max-width: 400px) {
width: 98%;
flex-direction: column;
}
.btn.close {
position: absolute;
top: 1em;
right: 1em;
font-size: 10px;
background-color: transparent;
padding: 0;
&:hover {
.d-icon {
color: var(--primary);
}
}
}
&-info {
width: 30%;
padding: 0.5em 2em 0.5em;
background-color: var(--primary-very-low);
@media screen and (min-width: 1000px) {
width: 40%;
display: grid;
grid-template-columns: 65% calc(40% - 2em);
grid-template-areas: "left right" "left right";
align-items: center;
}
@media screen and (max-width: 400px) {
width: calc(100% - 4em);
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: 1em;
}
&-header {
font-size: $font-up-6;
margin: 0;
@media screen and (max-width: 750px) {
font-size: $font-up-3;
}
}
&-success {
width: 100%;
margin: 0;
}
&-description {
width: 100%;
margin: 0.25em 0 1em 0;
@media screen and (max-width: 750px) {
font-size: $font-down-1;
}
@media screen and (max-width: 400px) {
text-align: center;
}
}
&-button {
grid-area: right;
height: 2.5em;
padding: 0.75em 1.5em 0.75em 2.75em;
position: relative;
.d-icon {
position: absolute;
left: 1em;
&.hover-heart {
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
}
&:hover {
.d-icon.hover-heart {
opacity: 1;
}
}
}
}
&-progress {
width: 60%;
padding: 1.5em 2em 1.5em;
@media screen and (max-width: 400px) {
width: calc(100% - 4em);
}
&-success {
height: 32px;
background: linear-gradient(
-45deg,
var(--tertiary-hover),
var(--tertiary-medium),
var(--tertiary-hover),
var(--tertiary-medium)
);
border-radius: 2em;
margin: 0;
background-size: 400% 100%;
animation: gradient 15s ease infinite;
}
&-description {
margin: 0.5em 0 0;
font-weight: 300;
strong {
font-weight: bold;
}
}
&-users {
align-items: center;
display: inline-flex;
margin: 0 0 -2em 0;
&-title {
strong {
font-weight: bold;
}
}
&-avatars {
margin: 0 0 0 0.5em;
}
}
progress[value] {
-webkit-appearance: none;
appearance: none;
height: 2.5em;
width: 100%;
border: 1px solid #e5e5e5;
border-radius: 2em;
background-color: var(--primary-very-low);
overflow: hidden;
}
progress[value]::-webkit-progress-bar {
background-color: var(--primary-very-low);
}
progress[value]::-webkit-progress-value {
background-color: var(--tertiary);
border-top-right-radius: 2em;
border-bottom-right-radius: 2em;
}
progress[value]::-moz-progress-bar {
background-color: var(--tertiary);
border-top-right-radius: 2em;
border-bottom-right-radius: 2em;
}
}
}
html:not(.mobile-view) {
.subscriptions-campaign,
.subscriptions-campaign-sidebar,
.subscriptions-campaign-topic-footer {
.goal-met .campaign-banner {
.campaign-banner-info {
&-description {
margin: 1em auto !important;
}
}
}
}
}
// Topic Footer Version
html:not(.mobile-view) .subscriptions-campaign-topic-footer .campaign-banner {
margin-top: 2em;
height: min-content;
width: calc(100% + 14em);
.btn.close {
top: 1em;
right: 1em;
}
.campaign-banner-info {
width: 65%;
&-header {
font-size: $font-up-6;
}
&-description {
font-size: $font-down-1;
margin: 0.25em 0.25em 1em 0 !important;
}
}
.campaign-banner-progress {
padding: 1.5em 2.5em 1em;
progress[value] {
height: 2em;
}
.campaign-banner-progress-users {
margin-top: 1em;
}
.campaign-banner-progress-users-title {
margin: 0;
}
}
}
// CSS Animations for campaign Success
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
/* Fireworks (modified to fit modern SASS standards)
Copyright (c) 2020 by Eddie Lin (https://codepen.io/yshlin/pen/ylDEk)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
$particles: 50;
$width: 500;
$halfwidth: calc($width / 2);
$height: 250;
$heightpartial: calc($height / 1.2);
// Create the explosion...
$box-shadow: ();
@for $i from 0 through $particles {
$box-shadow: $box-shadow,
random($width) -
$halfwidth +
px
random($height) -
$heightpartial +
px
hsl(random(360), 100%, 50%);
}
@mixin keyframes($animationName) {
@-webkit-keyframes #{$animationName} {
@content;
}
@-moz-keyframes #{$animationName} {
@content;
}
@-o-keyframes #{$animationName} {
@content;
}
@-ms-keyframes #{$animationName} {
@content;
}
@keyframes #{$animationName} {
@content;
}
}
@mixin animation-delay($settings) {
-moz-animation-delay: $settings;
-webkit-animation-delay: $settings;
-o-animation-delay: $settings;
-ms-animation-delay: $settings;
animation-delay: $settings;
}
@mixin animation-duration($settings) {
-moz-animation-duration: $settings;
-webkit-animation-duration: $settings;
-o-animation-duration: $settings;
-ms-animation-duration: $settings;
animation-duration: $settings;
}
@mixin animation($settings) {
-moz-animation: $settings;
-webkit-animation: $settings;
-o-animation: $settings;
-ms-animation: $settings;
animation: $settings;
}
@mixin transform($settings) {
transform: $settings;
-moz-transform: $settings;
-webkit-transform: $settings;
-o-transform: $settings;
-ms-transform: $settings;
}
body:not(.archetype-regular):not(.success-animation-off) {
.fireworks > .before,
.fireworks > .after {
position: absolute;
width: 5px;
height: 5px;
border-radius: 50%;
@include animation(
(
1s bang ease-out 1s 2 backwards,
1s gravity ease-in 1s 2 backwards,
5s position ease-in-out 1s 1 backwards
)
);
}
}
.fireworks > .after {
@include animation-delay((1.25s, 1.25s, 1.25s));
@include animation-duration((1.25s, 1.25s, 1.25s));
}
@include keyframes(bang) {
to {
box-shadow: $box-shadow;
}
}
@include keyframes(gravity) {
to {
@include transform(translateY(200px));
opacity: 0;
}
}
@include keyframes(position) {
0%,
19.9% {
margin-top: -2%;
margin-left: -43%;
}
20%,
39.9% {
margin-top: 2%;
margin-left: -18%;
}
40%,
59.9% {
margin-top: 0%;
margin-left: 0%;
}
60%,
79.9% {
margin-top: 4%;
margin-left: 18%;
}
80%,
99.9% {
margin-top: 6%;
margin-left: 56%;
}
}