bulma/sass/elements/title.sass

103 lines
3.2 KiB
Sass
Raw Normal View History

2020-08-15 06:30:41 +00:00
$title-color: var(--text-strong, #{$text-strong}) !default
2019-05-17 13:02:12 +00:00
$title-family: false !default
2020-08-15 06:30:41 +00:00
$title-size: var(--size-3, #{$size-3}) !default
$title-weight: var(--weight-semibold, #{$weight-semibold}) !default
2018-04-09 11:45:52 +00:00
$title-line-height: 1.125 !default
2017-07-28 21:57:51 +00:00
$title-strong-color: inherit !default
$title-strong-weight: inherit !default
2017-11-07 15:55:00 +00:00
$title-sub-size: 0.75em !default
$title-sup-size: 0.75em !default
2016-10-30 10:41:53 +00:00
2020-08-15 06:30:41 +00:00
$subtitle-color: var(--text, #{$text}) !default
2019-05-17 13:02:12 +00:00
$subtitle-family: false !default
2020-08-15 06:30:41 +00:00
$subtitle-size: var(--size-5, #{$size-5}) !default
$subtitle-weight: var(--weight-normal, #{$weight-normal}) !default
2018-04-09 11:45:52 +00:00
$subtitle-line-height: 1.25 !default
2020-08-15 06:30:41 +00:00
$subtitle-strong-color: var(--text-strong, #{$text-strong}) !default
$subtitle-strong-weight: var(--weight-semibold, #{$weight-semibold}) !default
2018-04-09 11:45:52 +00:00
$subtitle-negative-margin: -1.25rem !default
2016-10-30 10:41:53 +00:00
2016-01-24 00:03:43 +00:00
.title,
.subtitle
2020-08-15 06:30:41 +00:00
--title-sub-size: #{$title-sub-size}
--title-sup-size: #{$title-sup-size}
2018-09-04 13:24:50 +00:00
@extend %block
word-break: break-word
em,
span
2017-07-28 21:57:51 +00:00
font-weight: inherit
sub
2020-08-15 06:30:41 +00:00
font-size: var(--title-sub-size)
sup
2020-08-15 06:30:41 +00:00
font-size: var(--title-sup-size)
.tag
2016-12-23 13:59:26 +00:00
vertical-align: middle
2016-01-24 00:03:43 +00:00
.title
2020-08-15 06:30:41 +00:00
// Approach A
// CSS Variable takes precedence, if theme is included
// --title-color: var(--text-strong, #{$title-color})
// color: var(--title-color)
// Approach B
// Sass Variable takes precedence
// Problem: --title-color is always set, so the fallback is never used
// --title-color: #{$title-color}
// color: var(--title-color, var(--text-strong))
// Approach C
2020-08-15 06:55:18 +00:00
// Sass variable references a CSS variable with fallback
// $title-color: var(--text-strong, #{$text-strong})
2020-08-15 06:30:41 +00:00
--title-color: #{$title-color}
color: var(--title-color)
--title-size: #{$title-size}
--title-weight: #{$title-weight}
--title-line-height: #{$title-line-height}
--title-strong-color: #{$title-strong-color}
--title-strong-weight: #{$title-strong-weight}
font-size: var(--title-size)
font-weight: var(--title-weight)
line-height: var(--title-line-height)
2020-08-15 06:55:18 +00:00
@if $title-family
--title-family: #{$title-family}
font-family: var(--title-family)
2016-04-10 15:00:32 +00:00
strong
2020-08-15 06:30:41 +00:00
color: var(--title-strong-color)
font-weight: var(--title-strong-weight)
2016-01-24 00:03:43 +00:00
& + .highlight
2016-10-29 17:53:30 +00:00
margin-top: -0.75rem
2017-03-14 22:38:45 +00:00
&:not(.is-spaced) + .subtitle
2020-08-15 06:55:18 +00:00
margin-top: var(--subtitle-negative-margin)
2017-05-27 20:05:05 +00:00
// Sizes
2016-01-24 00:03:43 +00:00
@each $size in $sizes
$i: index($sizes, $size)
&.is-#{$i}
font-size: $size
.subtitle
2020-08-15 06:55:18 +00:00
--subtitle-negative-margin: #{$subtitle-negative-margin}
--subtitle-color: #{$subtitle-color}
--subtitle-size: #{$subtitle-size}
--subtitle-weight: #{$subtitle-weight}
--subtitle-line-height: #{$subtitle-line-height}
--subtitle-strong-color: #{$subtitle-strong-color}
--subtitle-strong-weight: #{$subtitle-strong-weight}
color: var(--subtitle-color)
font-size: var(--subtitle-size)
font-weight: var(--subtitle-weight)
line-height: var(--subtitle-line-height)
2019-05-17 13:02:12 +00:00
@if $subtitle-family
2020-08-15 06:55:18 +00:00
--subtitle-family: #{$subtitle-family}
font-family: var(--subtitle-family)
2016-04-10 15:00:32 +00:00
strong
2020-08-15 06:55:18 +00:00
color: var(--subtitle-strong-color)
font-weight: var(--subtitle-strong-weight)
2017-03-14 22:38:45 +00:00
&:not(.is-spaced) + .title
2020-08-15 06:55:18 +00:00
margin-top: var(--subtitle-negative-margin)
2017-05-27 20:05:05 +00:00
// Sizes
2016-01-24 00:03:43 +00:00
@each $size in $sizes
$i: index($sizes, $size)
&.is-#{$i}
font-size: $size