Problem/Motivation

Requested and part provided by Razem

Convert to use REM and EM instead of PX
- Install FULL MODULES EVER
- Fix PX to REM for font-sizes and line-height
- Fix EM for padding and margins
- Test

Proposed resolution

- #3170682: Convert to use REM and EM instead of PX
- Add the below new CSS to make the header appear over the Media Hero Slider in the homepage

#navbar-main {
    z-index: 1;
}
 

- Change the following values for Media Hero Slider CSS:
#3171094: Change the view empty style values for Media Hero Slider

.varbase-heroslider-media > .view-empty {
    padding: 25rem 0 3rem;
    background-position: 50% 5rem;
    background-size: 15rem;
    font-size: 1.75rem;
}

- Change the following values for the Footer:

.footer-wrapper .footer section.region-footer div[id$="-copyright"] {
    font-size: .75rem;
}
.footer-wrapper .footer section.region-footer .menu--footer {
    font-size: .75rem;
}

- Change the following for better login:

#auth-box .block-title {
    height: 1px;
    margin: 2rem 0;
}
#auth-box .block-title span {
    font-size: 1rem;
    padding: 0 .75rem;
    top: -1.5rem;
}
#auth-box #bottom-part {
    font-size: .75rem;
}

few are for Vartheme. some are for other modules

Remaining tasks

  • Install and scan all used or custom Varbase components
  • Fix PX to REM for font-sizes and line-height ( We may switch any to RFS )
  • Vartheme BS4 and VARTHEME_BS4_SUBTHEME
  • Fix EM for padding and margins
  • Test install and Test updates

User interface changes

Follow the default REM and EM for the root element of the HTML page.

API changes

N/A

Data model changes

N/A

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Changing

font-size: 1.75rem;

for example to

@include font-size(1.75rem);
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

  • RajabNatshah committed 8cd07eb on 8.x-6.x
    Issue #3170682: Convert to use REM and EM instead of PX
    
rajab natshah’s picture

About padding and margin

The Default Bootstrap 4.5.2 font size base
$font-size-base: 1rem !default; // Assumes the browser default, typically `16px`
https://github.com/twbs/bootstrap/blob/v4.5.2/scss/_variables.scss#L282

Any padding or margin can change the value to rem by (Value/16px)

For example

padding: 8px;
Could be changed to
padding: 0.5rem;

But with font change with RFS padding and margin needs RFS too

If we want to make this RFS, we are in need to upgrade RFS from ~8.0 to ~9.0
https://github.com/twbs/rfs#input

to be able

  +font-size(4rem)

  // The font-size mixin is a shorthand which calls
  // +rfs(4rem, font-size)

  // Other shorthand mixins that are available are:
  // +padding(4rem)
  // +padding-top(4rem)
  // +padding-right(4rem)
  // +padding-bottom(4rem)
  // +padding-left(4rem)
  // +margin(4rem)
  // +margin-top(4rem)
  // +margin-right(4rem)
  // +margin-bottom(4rem)
  // +margin-left(4rem)

  // For properties which do not have a shorthand, the property can be passed:
  // +rfs(4rem, border-radius)

  // Whenever a value contains a comma, it should be escaped with `#{}`:
  // +rfs(0 0 4rem red #{","} 0 0 5rem blue, box-shadow)
rajab natshah’s picture

// Shorthand helper mixins
@mixin font-size($value) {
  @include rfs($value);
}

@mixin padding($value) {
  @include rfs($value, padding);
}

@mixin padding-top($value) {
  @include rfs($value, padding-top);
}

@mixin padding-right($value) {
  @include rfs($value, padding-right);
}

@mixin padding-bottom($value) {
  @include rfs($value, padding-bottom);
}

@mixin padding-left($value) {
  @include rfs($value, padding-left);
}

@mixin margin($value) {
  @include rfs($value, margin);
}

@mixin margin-top($value) {
  @include rfs($value, margin-top);
}

@mixin margin-right($value) {
  @include rfs($value, margin-right);
}

@mixin margin-bottom($value) {
  @include rfs($value, margin-bottom);
}

@mixin margin-left($value) {
  @include rfs($value, margin-left);
}
rajab natshah’s picture

Assigned: rajab natshah » mohammed j. razem
Status: Active » Needs review
rajab natshah’s picture

In Bootstrap 4.5.2

$font-size-base:              1rem !default; // Assumes the browser default, typically `16px`
$font-size-lg:                $font-size-base * 1.25 !default;
$font-size-sm:                $font-size-base * .875 !default;

$font-weight-lighter:         lighter !default;
$font-weight-light:           300 !default;
$font-weight-normal:          400 !default;
$font-weight-bold:            700 !default;
$font-weight-bolder:          bolder !default;

$font-weight-base:            $font-weight-normal !default;
$line-height-base:            1.5 !default;

$h1-font-size:                $font-size-base * 2.5 !default;
$h2-font-size:                $font-size-base * 2 !default;
$h3-font-size:                $font-size-base * 1.75 !default;
$h4-font-size:                $font-size-base * 1.5 !default;
$h5-font-size:                $font-size-base * 1.25 !default;
$h6-font-size:                $font-size-base !default;

https://github.com/twbs/bootstrap/blob/v4.5.2/scss/_variables.scss#L282

and in RFS ~8 or ~9

// Base value
$rfs-base-value: 1.25rem !default;

https://github.com/twbs/rfs/blob/v9.0.3/scss.scss#L12

rajab natshah’s picture

rajab natshah’s picture

Assigned: mohammed j. razem » rajab natshah
Status: Needs review » Needs work
rajab natshah’s picture

Status: Needs work » Active
rajab natshah’s picture

After
#3171962: Update RFS from ~8.0 to ~9.0 for Vartheme BS4 and VARTHEME_BS4_SUBTHEME

line-height can follow the RFS on the font-size with the following for example

@include rfs(1.5rem, line-height);

As in

  // For properties which do not have a shorthand, the property can be passed:
  // +rfs(4rem, border-radius)

  // Whenever a value contains a comma, it should be escaped with `#{}`:
  // +rfs(0 0 4rem red #{","} 0 0 5rem blue, box-shadow)

  • RajabNatshah committed 9e4b053 on 8.x-6.x
    Issue #3170682: Convert to use REM and EM instead of PX
    

  • RajabNatshah committed 27328ca on 8.x-6.x
    Issue #3170682: Convert to use REM and EM instead of PX
    

  • RajabNatshah committed 11f9bc7 on 8.x-6.x
    Issue #3170682: Convert to use REM and EM instead of PX
    
rajab natshah’s picture

Assigned: rajab natshah » mohammed j. razem
Status: Active » Needs review
Issue tags: +varbase-8.8.7, +varbase-9.0.0

Touched all SCSS files

When we compile all SCSS files to CSS

rajab@vardot-dev:/var/www/html/products/vartheme_bs4$ gulp compile
[19:05:54] Using gulpfile /var/www/html/products/vartheme_bs4/gulpfile.js
[19:05:54] Starting 'compile'...
[19:05:57] Finished 'compile' after 3.26 s

and

rajab@vardot-dev:/var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME$ gulp compile
[19:12:02] Using gulpfile /var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME/gulpfile.js
[19:12:02] Starting 'compile'...
[19:12:05] Finished 'compile' after 3.35 s

and then check the Drupal Standard we will have no issues

rajab@vardot-dev:/var/www/html/products/vartheme_bs4$ yarn phpcs
yarn run v1.22.5
$ phpcs --standard=./.phpcs.xml .
Done in 5.20s.

I did not need to do a yarn phpcbf

rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
rajab natshah’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.