Icon and popup css fixes

## Issues
- So many `!important` overrides that makes it hard to customize.
- Weird "813px max-width" check -- it feels random, plus does not adjust accordingly to zoom-levels.
- The button text is not always vertically centered for all layout and zoom-levels because it is being centered using hardcoded margins.
- The 2 popups don't have consistent fonts and styling, plus their customizations are all over the place.

## Changes
- Try to remove as many unnecessary "!important" as possible. Adding specificity is sufficiently, and won't block other customizations.
- Try using `rem` instead of hardcoded margins. The icons/text/margin should resize accordingly per zoom-levels.
    - I didn't replicate the "813px max-width" media check. If it is really necessary, please use `vjs-layout-*` to customize them instead.
- Consolidate the 2 popup menu customizations.
This commit is contained in:
infinite-persistence 2021-12-08 12:09:54 +08:00
parent 47c5882ac5
commit 627b01c664
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 38 additions and 76 deletions

View file

@ -378,6 +378,12 @@
// Video // Video
// **************************************************************************** // ****************************************************************************
// DRY: we'll soon move vjs items to videojs.scss, so just duplicate these for now.
$control-bar-height: 2.1rem;
$control-bar-font-size: 0.8rem;
$control-bar-popup-font-size: 0.8rem;
$control-bar-icon-size: 0.7rem;
.video-js-parent { .video-js-parent {
height: 100%; height: 100%;
width: 100%; width: 100%;
@ -411,6 +417,22 @@
.vjs-duration { .vjs-duration {
display: flex; display: flex;
} }
.vjs-menu-button {
font-size: $control-bar-font-size;
line-height: $control-bar-height;
}
.vjs-icon-placeholder {
font-size: $control-bar-icon-size; // videojs icon font
line-height: $control-bar-height;
}
.vjs-quality-selector {
.vjs-icon-placeholder {
font-size: $control-bar-font-size; // quality selector uses regular text font
}
}
} }
.vjs-picture-in-picture-control { .vjs-picture-in-picture-control {
@ -548,18 +570,6 @@ video::-internal-media-controls-overlay-cast-button {
.vjs-duration { .vjs-duration {
padding-left: 0; padding-left: 0;
} }
.vjs-playback-rate .vjs-playback-rate-value {
// Reduce the gigantic font a bit. Default was 1.5em.
font-size: 1.25em;
line-height: 2.5;
}
.vjs-playback-rate .vjs-menu {
// Extend the width to prevent a potential scrollbar from blocking the text.
width: 8em;
left: -2em;
}
} }
.video-js.vjs-fullscreen { .video-js.vjs-fullscreen {

View file

@ -1,4 +1,7 @@
$control-bar-height: 41px; // would '3.5em' be better than px? $control-bar-height: 2.1rem;
$control-bar-font-size: 0.8rem;
$control-bar-popup-font-size: 0.8rem;
$control-bar-icon-size: 0.7rem;
.video-js { .video-js {
font-size: 12px; font-size: 12px;
@ -82,13 +85,16 @@ $control-bar-height: 41px; // would '3.5em' be better than px?
position: absolute !important; position: absolute !important;
}*/ }*/
// Menu size // Playback Rate
.vjs-playback-rate .vjs-menu .vjs-menu-content { .vjs-playback-rate {
width: 125%; .vjs-playback-rate-value {
font-size: 12px; font-size: $control-bar-font-size; // Reduce the gigantic font a bit. Default was 1.5em.
line-height: $control-bar-height; // Vertically center the text.
}
@media (max-width: 652px) { .vjs-menu {
font-size: 10px; width: 10em; // Extend the width to prevent a potential scrollbar from blocking the text.
left: -3em; // Center the popup on top of the button that invoked it.
} }
} }
@ -161,73 +167,19 @@ $control-bar-height: 41px; // would '3.5em' be better than px?
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 72px); background-image: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 72px);
} }
[dir] .video-js .vjs-control {
font-size: 14px;
@media (max-width: 813px) {
font-size: 12px;
}
}
.vjs-playback-rate {
margin-top: 3px;
font-size: 12px !important;
@media (max-width: 813px) {
margin-top: 3px !important;
font-size: 10px !important;
}
}
.vjs-quality-selector > .vjs-menu > .vjs-menu-content {
margin-bottom: 3px;
}
.vjs-hover { .vjs-hover {
opacity: 1; opacity: 1;
} }
[dir] .vjs-menu-button-popup .vjs-menu .vjs-menu-content { [dir] .vjs-menu-button-popup .vjs-menu .vjs-menu-content {
background-color: rgba(43, 51, 63); background-color: rgba(43, 51, 63);
} max-height: 20em;
.vjs-quality-selector > .vjs-menu > .vjs-menu-content { li {
font-size: 12px; font-size: $control-bar-popup-font-size;
@media (max-width: 652px) {
font-size: 10px;
} }
} }
.vjs-quality-selector > .vjs-menu {
height: 100%;
}
.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content {
max-height: 19em;
}
.vjs-time-divider div span {
font-size: 18px;
color: #dbd8d8;
position: absolute;
top: 4px;
@media (max-width: 813px) {
top: 0px;
}
}
.vjs-play-control {
font-size: 17px !important;
margin-top: -6px !important;
margin-right: -14px !important;
}
.vjs-play-control .vjs-icon-placeholder {
margin-right: -5px;
}
.vjs-slider-horizontal { .vjs-slider-horizontal {
background-color: #474747 !important; background-color: #474747 !important;
} }