Skip to content

A platform for community discussion. Free, open, simple.

UX: Improve share modal consistency (#13689)

Krise2d04a85923a
diff --git a/app/assets/javascripts/discourse/app/components/share-source.js b/app/assets/javascripts/discourse/app/components/share-source.js
index 1be7f586069..ae9f40730c2 100644
--- a/app/assets/javascripts/discourse/app/components/share-source.js
+++ b/app/assets/javascripts/discourse/app/components/share-source.js
@@ -1,7 +1,6 @@
import Component from "@ember/component";
export default Component.extend({
- classNameBindings: [":social-link"],
-
+ tagName: "",
actions: {
share: function (source) {
this.action(source);
diff --git a/app/assets/javascripts/discourse/app/initializers/sharing-sources.js b/app/assets/javascripts/discourse/app/initializers/sharing-sources.js
index 574c710e5af..e5770527e4b 100644
--- a/app/assets/javascripts/discourse/app/initializers/sharing-sources.js
+++ b/app/assets/javascripts/discourse/app/initializers/sharing-sources.js
@@ -9,7 +9,7 @@ export default {
Sharing.addSource({
id: "twitter",
- icon: "fab-twitter-square",
+ icon: "fab-twitter",
generateUrl: function (link, title, quote = "") {
const text = quote ? `"${quote}" -- ` : title;
return `http://twitter.com/intent/tweet?url=${encodeURIComponent(
@@ -39,7 +39,7 @@ export default {
Sharing.addSource({
id: "email",
- icon: "envelope-square",
+ icon: "envelope",
title: I18n.t("share.email"),
generateUrl: function (link, title, quote = "") {
const body = quote ? `${quote} \n\n ${link}` : link;
diff --git a/app/assets/javascripts/discourse/app/templates/components/share-source.hbs b/app/assets/javascripts/discourse/app/templates/components/share-source.hbs
index eaee0823d04..a2fdb3bf654 100644
--- a/app/assets/javascripts/discourse/app/templates/components/share-source.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/share-source.hbs
@@ -1,7 +1 @@
-<a href {{action "share" source}} title={{source.title}} aria-label={{source.title}}>
- {{#if source.icon}}
- {{d-icon source.icon}}
- {{else}}
- {{html-safe source.htmlIcon}}
- {{/if}}
-</a>
+{{d-button action=(action "share" source) class=(concat "share-" source.id) translatedTitle=source.title translatedAriaLabel=source.title icon=(if source.icon source.icon source.htmlIcon)}}
diff --git a/app/assets/javascripts/discourse/app/templates/modal/share-topic.hbs b/app/assets/javascripts/discourse/app/templates/modal/share-topic.hbs
index 4df72979dea..72752385123 100644
--- a/app/assets/javascripts/discourse/app/templates/modal/share-topic.hbs
+++ b/app/assets/javascripts/discourse/app/templates/modal/share-topic.hbs
@@ -19,7 +19,7 @@
{{/each}}
{{d-button
- class="btn-primary"
+ class="btn-default"
label="topic.share.notify_users.title"
icon="hand-point-right"
action=(action "toggleNotifyUsers")
@@ -27,7 +27,7 @@
{{#if allowInvites}}
{{d-button
- class="btn-primary"
+ class="btn-default"
label="topic.share.invite_users"
icon="user-plus"
action=(action "inviteUsers")
diff --git a/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
index 0d8e4c00490..fd0b5c016de 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/share-topic-test.js
@@ -30,15 +30,15 @@ acceptance("Share and Invite modal", function (needs) {
"it shows the topic sharing url"
);
- assert.ok(count(".social-link") > 1, "it shows social sources");
+ assert.ok(count("button[class^='share-']") > 1, "it shows social sources");
assert.ok(
- exists(".btn-primary[aria-label='Notify']"),
+ exists(".btn[aria-label='Notify']"),
"it shows the notify button"
);
assert.ok(
- exists(".btn-primary[aria-label='Invite']"),
+ exists(".btn[aria-label='Invite']"),
"it shows the invite button"
);
});
diff --git a/app/assets/stylesheets/common/base/modal.scss b/app/assets/stylesheets/common/base/modal.scss
index c35dfa35bb4..a74f4c1ecf1 100644
--- a/app/assets/stylesheets/common/base/modal.scss
+++ b/app/assets/stylesheets/common/base/modal.scss
@@ -969,31 +969,33 @@
}
.share-topic-modal {
+ form {
+ margin-bottom: 0;
+ }
.sources {
- align-items: center;
display: flex;
flex-wrap: wrap;
- flex-direction: row;
- margin-bottom: 1em;
-
- .social-link {
- font-size: $font-up-6;
- margin-right: 8px;
+ align-items: stretch;
+ button {
+ margin-right: 0.5em;
+ margin-bottom: 0.5em;
}
+ }
- .btn-primary {
- border-radius: 4px;
- height: calc(#{$font-up-6} - 4px);
- margin-bottom: 2px;
- margin-right: 8px;
- padding-left: 8px;
- padding-right: 8px;
-
- .d-icon {
- font-size: $font-up-3;
- }
+ .share-twitter {
+ .d-icon {
+ color: var(--twitter);
+ }
+ }
+ .share-facebook {
+ .d-icon {
+ color: var(--facebook);
}
}
+
+ .invite-users {
+ margin: 1em 0;
+ }
}
.group-add-members-modal {