Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 96bd052

Browse files
authored
Improve visibility of font size chooser (#6988)
* Improve visibility of font size chooser * Move slider dot sizes into variables * Use a standard font size instead of percentage in Slider * Use shorthand for padding in FontScalingPanel * Change Slider text pos to px to be consistent when font changes * Cleaner dot size for Slider selection
1 parent 8b6d5d5 commit 96bd052

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

res/css/_common.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ $EventTile_e2e_state_indicator_width: 4px;
2727
$MessageTimestamp_width: 46px; /* 8 + 30 (avatar) + 8 */
2828
$MessageTimestamp_width_hover: calc($MessageTimestamp_width - 2 * $EventTile_e2e_state_indicator_width);
2929

30+
$slider-dot-size: 1em;
31+
$slider-selection-dot-size: 2.4em;
32+
3033
:root {
3134
font-size: 10px;
3235

res/css/views/elements/_Slider.scss

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,31 @@ limitations under the License.
5454

5555
.mx_Slider_selectionDot {
5656
position: absolute;
57-
width: 1.1em;
58-
height: 1.1em;
57+
width: $slider-selection-dot-size;
58+
height: $slider-selection-dot-size;
5959
background-color: $slider-selection-color;
6060
border-radius: 50%;
6161
box-shadow: 0 0 6px lightgrey;
6262
z-index: 10;
6363
}
6464

65+
.mx_Slider_selectionText {
66+
color: $muted-fg-color;
67+
font-size: $font-14px;
68+
position: relative;
69+
text-align: center;
70+
top: 30px;
71+
width: 100%;
72+
}
73+
6574
.mx_Slider_selection > hr {
6675
margin: 0;
6776
border: 0.2em solid $slider-selection-color;
6877
}
6978

7079
.mx_Slider_dot {
71-
height: 1em;
72-
width: 1em;
80+
height: $slider-dot-size;
81+
width: $slider-dot-size;
7382
border-radius: 50%;
7483
background-color: $slider-background-color;
7584
z-index: 0;

res/css/views/settings/_FontScalingPanel.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ limitations under the License.
3434
display: flex;
3535
flex-direction: row;
3636
align-items: center;
37-
padding: 15px;
37+
padding: 15px 15px 35px;
3838
background: rgba($appearance-tab-border-color, 0.2);
3939
border-radius: 10px;
4040
font-size: 10px;

src/components/views/elements/Slider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ export default class Slider extends React.Component<IProps> {
8686
if (!this.props.disabled) {
8787
const offset = this.offset(this.props.values, this.props.value);
8888
selection = <div className="mx_Slider_selection">
89-
<div className="mx_Slider_selectionDot" style={{ left: "calc(-0.55em + " + offset + "%)" }} />
89+
<div className="mx_Slider_selectionDot" style={{ left: "calc(-1.195em + " + offset + "%)" }}>
90+
<div className="mx_Slider_selectionText">{ this.props.value }</div>
91+
</div>
9092
<hr style={{ width: offset + "%" }} />
9193
</div>;
9294
}

test/components/views/settings/__snapshots__/FontScalingPanel-test.tsx.snap

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,16 @@ exports[`FontScalingPanel renders the font scaling UI 1`] = `
8383
className="mx_Slider_selectionDot"
8484
style={
8585
Object {
86-
"left": "calc(-0.55em + 50%)",
86+
"left": "calc(-1.195em + 50%)",
8787
}
8888
}
89-
/>
89+
>
90+
<div
91+
className="mx_Slider_selectionText"
92+
>
93+
15
94+
</div>
95+
</div>
9096
<hr
9197
style={
9298
Object {

0 commit comments

Comments
 (0)