UX: Improve mobile campaign flow (#69)

1. Improve mobile checkout styling

These are pretty simple changes. The buttons were crammed together and not wrapping properly on mobile if there were more than a few. Also the padding was weird and causing text to overflow out of the #main-outlet on phone viewports.
2. Renders the top campaign banner on mobile even if sidebar is selected

In the original PR, we refactored using the connector JS out since we now have more Ember operators; however, we needed some more complex logic that couldn't be done in the template. Basically, we choose which outlet to render the component in based on two criteria:

    If the setting is set to sidebar or top
    If we're on a mobile device

Previously, if the site showed the banner on the sidebar and the user browsed to mobile, they wouldn't see a banner at all. This PR changes the logic to use the top outlet on mobile, even if the sidebar is selected.
This commit is contained in:
Justin DiRose 2021-06-08 12:52:29 -05:00 committed by GitHub
parent 2d7807aeb3
commit 791c7fa7a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 11 deletions

View File

@ -0,0 +1,12 @@
export default {
shouldRender(args, component) {
const { siteSettings } = component;
const mobileView = component.site.mobileView;
const bannerLocation =
siteSettings.discourse_subscriptions_campaign_banner_location;
return (
bannerLocation === "Top" || (bannerLocation === "Sidebar" && mobileView)
);
},
};

View File

@ -0,0 +1,10 @@
export default {
shouldRender(args, component) {
const { siteSettings } = component;
const mobileView = component.site.mobileView;
const bannerLocation =
siteSettings.discourse_subscriptions_campaign_banner_location;
return bannerLocation === "Sidebar" && !mobileView;
},
};

View File

@ -1,3 +1 @@
{{#unless (eq siteSettings.discourse_subscriptions_campaign_banner_location "Sidebar")}} {{campaign-banner}}
{{campaign-banner}}
{{/unless}}

View File

@ -1,3 +1 @@
{{#if (eq siteSettings.discourse_subscriptions_campaign_banner_location "Sidebar")}} {{campaign-banner}}
{{campaign-banner}}
{{/if}}

View File

@ -7,6 +7,8 @@
@include breakpoint(medium) { @include breakpoint(medium) {
flex-direction: column; flex-direction: column;
margin: 0;
padding: 0.5em;
} }
.section-column { .section-column {
@ -26,10 +28,12 @@
&:last-child { &:last-child {
order: 2; order: 2;
margin-left: 0;
} }
&:first-child { &:first-child {
order: 1; order: 1;
margin-right: 0;
} }
} }
} }

View File

@ -1,13 +1,13 @@
.subscribe-buttons { .subscribe-buttons {
display: flex; display: flex;
justify-content: space-around; flex-flow: row wrap;
justify-content: left;
.btn-discourse-subscriptions-subscribe { .btn-discourse-subscriptions-subscribe {
flex-direction: column; flex-direction: column;
padding: 10px 20px; margin: 0.25em;
div { padding: 1em;
margin-bottom: 5px; width: 6em;
}
} }
} }