discourse/app/assets/stylesheets/wizard.scss
Arpit Jalan 10f200a5d3
FEATURE: revamped wizard (#17477)
* FEATURE: revamped wizard

* UX: Wizard redesign (#17381)

* UX: Step 1-2

* swap out images

* UX: Finalize all steps

* UX: mobile

* UX: Fix test

* more test

* DEV: remove unneeded wizard components

* DEV: fix wizard tests

* DEV: update rails tests for new wizard

* Remove empty hbs files that were created because of rebase

* Fixes for rebase

* Fix wizard image link

* More rebase fixes

* Fix rails tests

* FIX: Update preview for new color schemes: (#17481)

* UX: make layout more responsive, update images

* fix typo

* DEV: move discourse logo svg to template only component

* DEV: formatting improvements

* Remove unneeded files

* Add tests for privacy step

* Fix banner image height for step "ready"

Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com>
Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2022-07-27 06:53:01 +05:30

684 lines
16 KiB
SCSS

$wizard-bg: svg-uri(
'<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="1906.75" height="980" viewBox="0 0 1906.75 980">
<path d="M488.66,863.09c-.95,0-1.9,.08-2.87,.23-10.9,1.74-20.73,12.53-18.33,27.56,2.4,15.03,16.43,23.52,27.44,21.76,5.23-.84,9.15-3.57,11.65-8.12,2.72-4.93,3.55-11.8,2.36-19.32-1.19-7.39-4.29-13.63-8.75-17.6-3.35-2.98-7.28-4.52-11.49-4.52Zm3.05,65.4c-18.96,0-36.43-14.97-39.65-35.14-3.53-22.1,10.2-42.06,31.26-45.43,9.94-1.58,19.59,1.27,27.2,8.04,7.14,6.35,12.04,15.87,13.78,26.78,1.78,11.1,.36,21.23-4.08,29.3-4.8,8.74-12.92,14.41-22.86,16-1.89,.3-3.77,.45-5.65,.45Z"/>
<path d="M252.13,687.19c0,42.64-27.43,60.69-72.35,60.69s-101.49-63.7-101.49-106.34,70.65-54.87,115.57-54.87,58.27,57.88,58.27,100.52Z" style="fill: #0ca64e; fill-rule: evenodd;"/>
<path d="M1849.08,829.55c-90.96,16.64-161.99-38.28-219.31-142.86-47.68-87.02,25.41-193.64,97.18-244.1,80.59-56.65,193.7,26.32,248.35,183.9,32.51,93.76-28.61,185.21-126.22,203.06Z" style="fill: #e84a51; fill-rule: evenodd;"/>
<path d="M1749.82,834.36c-17.29,16.8-36.86,24.94-53.76,12.76-16.9-12.18-19.47-31.75-3.5-49.8,15.58-17.6,37.62-33.19,54.52-21.02,16.9,12.18,20.84,40.46,2.74,58.05Z" style="fill: #fbf5af; fill-rule: evenodd;"/>
<path d="M269.84,223.52c0,19.4-22.98,39.33-40.94,39.33s-38.06-16.61-38.06-36.01,25.03-43.21,42.99-43.21,36.01,20.49,36.01,39.89Z" style="fill: #f0794a; fill-rule: evenodd;"/>
</svg>'
);
$wizard-mobile-bg: svg-uri(
'<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="390" height="844" viewBox="0 0 390 844">
<path d="M65.11,755.03c-.95,0-1.9,.08-2.87,.23-10.9,1.74-20.73,12.53-18.33,27.56,2.4,15.03,16.43,23.52,27.44,21.76,5.23-.84,9.15-3.57,11.65-8.12,2.72-4.93,3.55-11.8,2.36-19.32-1.19-7.39-4.29-13.63-8.75-17.6-3.35-2.98-7.28-4.52-11.49-4.52h-.01Zm3.05,65.41c-18.96,0-36.43-14.97-39.65-35.14-3.53-22.1,10.2-42.06,31.26-45.43,9.94-1.58,19.59,1.27,27.2,8.04,7.14,6.35,12.04,15.87,13.78,26.78,1.78,11.1,.36,21.23-4.08,29.3-4.8,8.74-12.92,14.41-22.86,16-1.89,.3-3.77,.45-5.65,.45h0Z"/>
<path d="M118.58,461.13c0,42.64-27.43,60.69-72.35,60.69s-101.49-63.7-101.49-106.34,70.65-54.87,115.57-54.87,58.27,57.88,58.27,100.52h0Z" style="fill: #0ca64e; fill-rule: evenodd;"/>
<path d="M492.26,712.49c-90.96,16.64-161.99-38.28-219.31-142.86-47.68-87.02,25.41-193.64,97.18-244.1,80.59-56.65,193.7,26.32,248.35,183.9,32.51,93.76-28.61,185.21-126.22,203.06h0Z" style="fill: #e84a51; fill-rule: evenodd;"/>
<path d="M393,717.3c-17.29,16.8-36.86,24.94-53.76,12.76s-19.47-31.75-3.5-49.8c15.58-17.6,37.62-33.19,54.52-21.02,16.9,12.18,20.84,40.46,2.74,58.05h0Z" style="fill: #fbf5af; fill-rule: evenodd;"/>
<path d="M69.29,124.46c0,19.4-22.98,39.33-40.94,39.33S-9.71,147.18-9.71,127.78s25.03-43.21,42.99-43.21,36.01,20.49,36.01,39.89Z" style="fill: #f0794a; fill-rule: evenodd;"/>
</svg>'
);
@keyframes bump {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
body.wizard {
background: $wizard-bg;
background-size: 110vw 110vh; // crops better than cover at various viewport sizes
background-repeat: no-repeat;
background-position: bottom;
color: var(--primary-very-high);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen-Sans, Ubuntu, Cantarell, Arial, sans-serif;
#wizard-main {
display: flex;
flex-direction: column;
align-items: center;
}
@media screen and (max-height: 900px) {
.desktop-view & {
#main-outlet {
padding-top: 0;
}
}
}
.discourse-logo svg {
height: 70px;
width: auto;
@include breakpoint("mobile-extra-large") {
height: 50px;
}
@media screen and (max-height: 900px) {
.desktop-view & {
display: none;
}
}
}
@include breakpoint("mobile-extra-large") {
background: $wizard-mobile-bg;
background-size: cover;
background-repeat: no-repeat;
background-position: bottom;
}
}
// Refactored SCSS
.wizard-container {
position: relative;
z-index: 11;
background-color: var(--secondary);
box-shadow: 0 4px 19px 6px rgba(var(--primary-rgb), 0.05);
box-sizing: border-box;
margin: 3em auto 1.5em auto;
padding: 0;
max-width: 85%;
min-width: 35%;
width: 100%;
border: 1px solid var(--primary-low);
border-radius: 8px;
padding: 2em 3em;
@media screen and (max-height: 800px) {
.desktop-view & {
margin: 1em auto;
}
}
@include breakpoint("mobile-extra-large") {
padding: 2em 1.5em;
max-width: 99%;
margin: 1.5em auto;
}
&__fields {
width: 100%;
padding-right: 20%;
@include breakpoint("large") {
padding-right: 0;
}
}
&__step-banner {
@include breakpoint("large") {
display: none;
}
}
&__step.branding .wizard-container__fields {
padding-right: 0;
display: flex;
flex-wrap: wrap;
gap: 0 2em;
.wizard-container__field {
flex: 1 1 45%;
@include breakpoint("large") {
flex: 1 1 100%;
}
}
}
&__step.branding .wizard-container__field {
@include breakpoint("mobile-extra-large") {
max-width: 100%;
}
}
&__step.branding .wizard-container__description {
max-width: 25em;
@include breakpoint("mobile-extra-large") {
display: none;
}
}
&__step.branding .wizard-container__preview canvas {
@include breakpoint("mobile-extra-large") {
max-width: 100%;
height: auto;
}
}
&__step.corporate .wizard-container__fields {
display: grid;
grid-template-columns: repeat(2, calc(50% - 1em));
grid-column-gap: 2em;
grid-template-rows: repeat(3, auto);
padding-right: 0;
@media only screen and (max-device-width: 568px) {
display: flex;
flex-wrap: wrap;
}
}
&__field {
margin-bottom: 1em;
}
&__field.checkbox-field {
margin-bottom: 3.5em;
@media only screen and (max-device-width: 568px) {
margin-bottom: 1em;
}
}
&__field.invalid input {
outline: 0;
border: 3px solid var(--danger);
animation: bump 0.25s ease-in-out;
animation-iteration-count: 2;
}
&__field label {
display: block;
}
&__field.component-styling-preview {
display: inline;
@media only screen and (max-device-width: 568px) {
display: none;
}
}
&__field.text-governing-law,
&__field.text-city-for-disputes {
@media only screen and (max-device-width: 568px) {
display: none;
}
}
&__step-form {
display: flex;
}
&__sidebar {
width: 170px;
box-sizing: border-box;
margin-right: 1em;
+ .wizard-container__fields {
padding: 1em;
background: var(--primary-very-low);
width: calc(100% - 170px);
border-radius: 0.5em;
margin-top: -1em;
}
}
.preview-nav {
display: flex;
justify-content: flex-end;
position: relative;
margin-top: -1px;
padding-right: 10px;
.preview-nav-button {
text-align: center;
padding: 10px 15px;
cursor: pointer;
margin-left: 10px;
font-size: 14px;
font-weight: bold;
color: var(--primary-high);
&.active {
background: var(--secondary);
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
color: var(--tertiary);
border-top: none;
}
}
}
.previews {
position: relative;
height: 320px;
width: 100%;
overflow: hidden;
background: var(--secondary);
border-radius: 10px;
cursor: grab;
user-select: none;
&.dragging {
cursor: grabbing;
}
.topic-preview {
position: absolute;
left: 0px;
top: 0px;
}
.homepage-preview {
position: absolute;
left: calc(100% + 25px);
top: 0px;
}
}
&__step-title {
font-size: 2.75em;
color: var(--primary);
line-height: $line-height-medium;
margin: 0 0 1.5em 0;
@include breakpoint("medium") {
font-size: var(--font-up-5);
}
}
&__step-container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
&__step-contents {
min-height: 37em;
margin-bottom: 2em;
}
&__step-form {
flex: 1 0 50%;
@media only screen and (max-device-width: 568px) {
width: 100%;
}
}
@media only screen and (max-device-width: 568px) {
&__step.introduction .wizard-container__step-banner,
&__step.privacy .wizard-container__step-banner {
display: none;
}
}
&__step-banner {
flex: 0 1 40%;
}
&__step-banner-image {
width: 100%;
}
&__step.ready {
.wizard-container__step-banner {
display: flex;
flex: 1 0 100%;
gap: 2em;
}
.wizard-container__step-description {
font-size: var(--font-up-3);
flex: 1 0 40%;
@include breakpoint("tablet") {
font-size: var(--font-up-2);
}
}
.wizard-container__step-banner-image {
padding-top: 2em;
flex: 0 1 40%;
margin-left: 2em;
max-height: 300px;
@include breakpoint("large") {
display: none;
}
}
}
&__step.branding .wizard-container__description {
font-size: var(--font-0);
}
&__step-progress {
display: flex;
align-items: center;
font-weight: bold;
margin-right: -1.5em;
@media screen and (max-width: 767px) {
display: none;
}
@include breakpoint("mobile-extra-large") {
margin-bottom: 1em;
}
.wizard-container__link {
color: var(--primary-400);
margin: 0 1em;
&.inactive {
// disabling instead of removing, to hold space
pointer-events: none;
opacity: 0;
}
}
}
&__step-text {
display: inline;
margin-right: 0.25em;
@media only screen and (max-device-width: 568px) {
display: none;
}
}
&__step-count {
min-width: 3.2em;
text-align: center;
}
.preloaded-font-styles {
font-size: 1px;
}
&__link {
margin-right: 1em;
text-decoration: none;
color: var(--primary-high);
font-size: var(--font-up-1);
}
&__link:hover {
color: var(--tertiary-hover);
}
&__button {
border-radius: 2px;
font-size: var(--font-0);
border: 0;
padding: 0.5em;
transition: background-color 0.3s;
text-decoration: none;
background-color: var(--secondary);
color: var(--primary-very-high);
cursor: pointer;
font-size: var(--font-up-1);
}
&__button.small {
padding: 0.25em 0.5em;
font-size: var(--font-down-1);
}
&__button:hover,
&__button:focus {
background-color: var(--primary-low);
}
&__button:active {
background-color: var(--primary-low-mid);
}
&__button:disabled,
&__button.disabled {
background-color: var(--primary-medium);
}
&__button .d-icon-chevron-right {
margin-left: 0.25em;
font-size: 0.8em;
}
&__button .d-icon-chevron-left {
margin-right: 0.25em;
font-size: 0.8em;
}
&__button.primary {
background-color: var(--tertiary);
color: var(--secondary);
}
&__button.primary:hover,
&__button.primary:focus {
background-color: var(--tertiary-hover);
}
&__button.primary:active {
background-color: var(--tertiary-high);
}
&__button.primary:disabled {
background-color: var(--tertiary-low);
}
&__button.configure-more {
background-color: var(--primary-200);
color: var(--primary);
}
&__button.configure-more:hover {
background-color: var(--primary-300);
color: var(--primary);
}
&__button.jump-in {
background-color: var(--success);
color: var(--secondary);
&:hover {
background-color: var(--success-hover);
}
}
&__button.finish {
color: var(--tertiary);
padding: 0;
}
&__button.finish:hover {
color: var(--tertiary-hover);
background-color: transparent;
}
&__button.finish:active,
&__button.finish:disabled {
background-color: transparent;
}
&__button.next {
min-width: 70px;
}
&__button.danger {
background-color: var(--danger);
color: var(--secondary);
}
&__button.danger:hover,
&__button.danger:focus {
background-color: var(--danger-hover);
}
&__button.danger:active {
background-color: var(--danger-medium);
}
&__button.danger:disabled {
background-color: var(--danger-low);
}
&__button-upload {
background-color: var(--primary-low);
display: block;
}
&__button-upload:hover {
background-color: var(--primary-low-mid);
}
&__button-upload svg {
margin-left: 0.5em;
}
.wizard-hidden-upload-field {
visibility: hidden;
position: absolute;
}
&__button:last-child {
margin-right: 0;
}
&__step-footer {
display: flex;
justify-content: space-between;
align-items: center;
@media only screen and (max-device-width: 568px) {
flex-direction: column;
justify-content: center;
}
}
&__buttons {
display: flex;
flex-wrap: wrap;
gap: 1em;
align-items: center;
}
&__image-upload {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: baseline;
}
&__label {
font-weight: bold;
font-size: var(--font-up-2);
@media only screen and (max-device-width: 568px) {
font-size: var(--font-up-1);
}
}
&__step.styling .wizard-container__label {
font-size: var(--font-0);
}
&__label.required {
display: inline;
color: var(--danger);
}
&__description {
color: var(--primary-high);
font-size: var(--font-down-1);
margin: 0.25em 0 0.5em 0;
a {
margin: 0;
}
@media only screen and (max-device-width: 568px) {
font-size: var(--font-0);
}
}
&__description.extra {
color: var(--primary-high);
font-size: var(--font-up-1);
margin: 0.25em 0 0.5em 0;
max-width: 400px;
}
&__text-input {
border-radius: 4px !important;
padding: 5px;
width: 100%;
font-size: var(--font-up-1);
margin: 0;
padding: 10px;
background-color: var(--secondary);
border: 1px solid var(--primary-low-mid);
transition: border-color 0.5s;
}
&__dropdown .select-kit-header:not(.btn) {
border-radius: 4px;
}
&__dropdown.color-palettes .select-kit-row.color-palettes-row .name {
flex: 0 0 30%;
}
&__dropdown.color-palettes .select-kit-row.color-palettes-row .palettes {
flex: 1 1 70%;
overflow: hidden;
}
&__field.checkbox-field .wizard-container__label {
cursor: pointer;
display: inline-block;
}
&__checkbox-slider {
display: inline-block;
background: var(--primary-low-mid);
border-radius: 16px;
width: 58px;
height: 32px;
margin-right: 0.5em;
position: relative;
vertical-align: middle;
transition: background 0.25s;
@media only screen and (max-device-width: 568px) {
height: 20px;
width: 35px;
}
}
&__checkbox-slider:before,
&__checkbox-slider:after {
content: "";
}
&__checkbox-slider:before {
display: block;
background: var(--secondary);
border-radius: 50%;
width: 24px;
height: 24px;
position: absolute;
top: 4px;
left: 4px;
transition: left 0.25s;
@media only screen and (max-device-width: 568px) {
height: 12px;
width: 12px;
}
}
&__field.checkbox-field
.wizard-container__label:hover
.wizard-container__checkbox-slider:before {
background: var(--secondary);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
&__checkbox:checked + .wizard-container__checkbox-slider {
background: var(--tertiary);
}
&__checkbox:checked + .wizard-container__checkbox-slider:before {
left: 30px;
@media only screen and (max-device-width: 568px) {
left: 20px;
}
}
&__checkbox {
position: absolute;
visibility: hidden;
}
&__checkbox-label {
position: relative;
top: 2px;
}
.wizard-container__image-upload canvas {
border: 1px solid rgba(0, 0, 0, 0.2);
}
}