カスタム Discourse リアクション

Hello,

I made some CSS modification on Discourse Reactions Plugin. So it looks much like Facebook reaction buttons.

These for 6 reaction buttons including the default which is on my site is :heart: .

COMMON / SCSS
Place this code to common - css section.
Important notice: You can modify the emojis above label with edit content: 'Love it!', content: 'Beautiful' etc… lines: Of course you can use whatever reaction you want. It is just a label above the reactions.

.discourse-reactions-picker {
  .discourse-reactions-picker-container {
    width: 330px;
    height: 50px;
    max-width: calc(100vw - 2em);
    border: 1px solid var(--primary-low) !important;
    border-radius: 50px;
    .pickable-reaction {
      max-width: 100% !important;
      margin: 0 !important;
      padding: 0 !important;
    }
  }
  .pickable-reaction {
    background: transparent !important;
    .emoji {
      height: 40px;
      width: 40px;
      padding: 0 !important;
      transform: scale(0.9);
    }
    &.is-used {
      transform: scale(1.3);
      transform-origin: bottom;
      border: none !important;
    }
    &:hover {
      transform-origin: bottom;
    }
    &:hover:after {
      position: absolute;
      font-size: 10px;
      top: -15px;
      background: var(--secondary-low);
      color: var(--secondary);
      padding: 2px 5px;
      border-radius: 20px;
    }
    &:first-child {
      &:hover:after {
        content: 'Love it!';
      }
    }
    &:nth-child(2) {
      &:hover:after {
        content: 'Beautiful';
      }
    }
    &:nth-child(3) {
      &:hover:after {
        content: 'Hug';
      }
    }
    &:nth-child(4) {
      &:hover:after {
        content: 'Congrats!!';
      }
    }
    &:nth-child(5) {
      &:hover:after {
        content: 'Hmm...';
      }
    }
    &:nth-child(6) {
      &:hover:after {
        content: 'Wooow!';
      }
    }
  }
}

react-buttons


Mobile

On mobile I set position fixed the reactions picker position.

This is a possible option to prevent this strange behaviour. :arrow_down:
raction-no-fixed

Looks like this :arrow_down:
reactions-fixed

Same thing happening with state panel on mobile that was on reactions picker so also use position fixed.

Mobile / SCSS

.discourse-reactions-picker {
  position: fixed;
  .pickable-reaction {
    &:hover:after {
      font-size: 12px;
      top: -8px;
    }
    &.is-used {
      &:hover:after {
        transform: scale(0.8);
        top: -15px;
      }
    }
  }
}

.discourse-reactions-state-panel {
  position: fixed;
}

Hide default who liked section

COMMON / CSS

I hide the default who’s liked section because the Reactions State Panel also show those informations.

.who-liked {
  display: none;
}
「いいね!」 25

Like it very much :love_you_gesture:

「いいね!」 5

Awesone this works really nice. Thanks for sharing
:beers::sunglasses::+1::sparkles:

「いいね!」 4

I have it installed and I love it.

A question:

Is it possible to remove that black hover?

「いいね!」 2

Hi Paulina,

I am really glad you like it :heart: Thank you!

To hide the dark hovered user list panel use this code :slightly_smiling_face:

.discourse-reactions-list .reactions .user-list {
  display: none;
}
「いいね!」 4

It worked for me! I love the way it looks, thank you very much. :heart:

「いいね!」 2

Hi Don,

I like your customization very much. A great Job and thanks! :heart:
but I still have a question, how to get rid of the black hover like this?

Selection_060

「いいね!」 3

Hi Neo,

Thank you :heart:

Unfortunately that is not possible to hide title attribute with css but you can edit the js.discourse_reactions.picker.react_with text on /admin/customize/site_texts to make it less longer.

「いいね!」 3

Thanks, I’ve done with it, now it looks better! :wave:

「いいね!」 3

これは素晴らしいですね、@Don。本当にありがとうございます。

これを私のDiscourseセットアップで使用することを検討していますが、現在、リアクションオプションが2行(1行あたり6つの絵文字、合計12個の絵文字)あります。

私はCSSについて最低限の知識しかなく、得意ではありません。

このコードを、そのような配置で機能するように調整するのはどのくらい難しいでしょうか?

(かなり遅れてしまいましたが!)共有していただき、本当に感謝しています。

「いいね!」 3

JRさん、ありがとうございます:slightly_smiling_face: これをテーマコンポーネント化して、リアクションへの適用や修正などを容易にできるようにしたいと思います。来週には作成する予定です。

「いいね!」 5

ありがとうございます、ドンさん!それは素晴らしいことで、大変ありがたい追加となります。ぜひ楽しみにしています。

「いいね!」 3

Happy So Excited GIF

「いいね!」 2

こんにちは。

これをもとにテーマコンポーネントを作成しました。より簡単になると思います。:slightly_smiling_face:

@manuel さんの以前作成されたテーマコンポーネント Category List with Banners のおかげで、リアクションラベルにリスト設定を簡単に実装できます。ありがとうございます :heart:

修正といくつかの設定を追加しました。

  1. reactions_label
    セミコロン ; で区切ります。
    リアクション名;リアクションラベル
    May-29-2022 17-02-05

  2. reactions picker rounding
    リアクションピッカー(border-radius)の角の丸み。px、em などが使用できます。
    デフォルトは 1em です。

より丸くしたり、丸みを少なくしたい場合は、この設定を変更してください。
以前のバージョンは 2em でした。

  1. state panel rounding
    リアクションステートパネル(border-radius)の角の丸み。px、em などが使用できます。

  2. user list rounding
    リアクションユーザーリスト(border-radius)の角の丸み。px、em などが使用できます。

  3. hide user list heading
    このオプションは、パネルのユーザーリストの見出しを非表示にします。この画像では、見出しは smiley です。

  4. hide user list
    このオプションは、ユーザーリストパネルを非表示にします。これはダークホバーパネルです。

  5. hide who liked
    このオプションは、デフォルトの「誰がいいねしたか」セクションを非表示にします。

このコンポーネントには、さらにいくつかの計画があり、後で追加する予定です。:slightly_smiling_face:

「いいね!」 17