From 9081417a257077ab2d059d0a9c938f567ed7ad31 Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Tue, 5 Mar 2024 22:06:26 +0600 Subject: [PATCH] Fixed down-voting and error messages styles in entry voting --- .../comment/__snapshots__/index.spec.tsx.snap | 4 +- .../__snapshots__/index.spec.tsx.snap | 112 ++++-------------- .../components/entry-vote-btn/_index.scss | 1 + .../components/entry-vote-btn/index.tsx | 5 +- src/style/_mixins.scss | 8 +- 5 files changed, 32 insertions(+), 98 deletions(-) diff --git a/src/common/components/comment/__snapshots__/index.spec.tsx.snap b/src/common/components/comment/__snapshots__/index.spec.tsx.snap index a413a3a6577..c6c9c472ec2 100644 --- a/src/common/components/comment/__snapshots__/index.spec.tsx.snap +++ b/src/common/components/comment/__snapshots__/index.spec.tsx.snap @@ -219,7 +219,7 @@ exports[`(1) Default render 1`] = `
@@ -584,7 +584,7 @@ exports[`(2) Cancellable, in progress 1`] = `
diff --git a/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap b/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap index 3ad22b6ba7a..52de0baf2e4 100644 --- a/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap +++ b/src/common/components/entry-vote-btn/__snapshots__/index.spec.tsx.snap @@ -42,102 +42,34 @@ Array [ className="slider slider-up" >
+
-
- -
-
-
- -
-
- -
-
- -
-
-
+ className="css-1ldz52l-Slider" + />
diff --git a/src/common/components/entry-vote-btn/_index.scss b/src/common/components/entry-vote-btn/_index.scss index 251c4467276..5426b039530 100644 --- a/src/common/components/entry-vote-btn/_index.scss +++ b/src/common/components/entry-vote-btn/_index.scss @@ -40,6 +40,7 @@ z-index: 2; left: -12px; top: -19px; + white-space: pre-wrap; @media screen and (max-width: 1700px) { width: 50vw; diff --git a/src/common/components/entry-vote-btn/index.tsx b/src/common/components/entry-vote-btn/index.tsx index beab7ec885d..40da865e0ae 100644 --- a/src/common/components/entry-vote-btn/index.tsx +++ b/src/common/components/entry-vote-btn/index.tsx @@ -263,8 +263,9 @@ export class VoteDialog extends Component { dynamicProps, entry: { post_id } } = this.props; - const { downSliderVal, initialVoteValues } = this.state; + const { downSliderVal: downSliderAbsoluteVal, initialVoteValues } = this.state; const { downVoted } = this.props.isVoted(); + const downSliderVal = downSliderAbsoluteVal * -1; if (!downVoted || (downVoted && initialVoteValues.down !== downSliderVal)) { const estimated = Number(this.estimate(downSliderVal).toFixed(3)); @@ -274,7 +275,7 @@ export class VoteDialog extends Component { setVoteValue("downPrevious", `${activeUser?.username!}-${post_id}`, downSliderVal); ls.set( this.props.isPostSlider ? "post_downSlider_value" : "comment_downSlider_value", - downSliderVal + downSliderAbsoluteVal ); } else if (downVoted && initialVoteValues.down === downSliderVal) { this.setState({ wrongValueDown: true, wrongValueUp: false }); diff --git a/src/style/_mixins.scss b/src/style/_mixins.scss index 5bc3a5504df..98e0c1282dc 100644 --- a/src/style/_mixins.scss +++ b/src/style/_mixins.scss @@ -400,6 +400,10 @@ .btn-inner { @apply text-red-020-50; + + svg { + transform: rotate(180deg); + } } &:hover, @@ -410,10 +414,6 @@ @apply text-white; } } - - svg { - transform: rotate(180deg); - } } &.vote-btn-lg {