bulma/sass/components/message.sass

118 lines
4.4 KiB
Sass
Raw Normal View History

2020-08-15 08:36:21 +00:00
$message-background-color: var(--background, #{$background}) !default
$message-font-size: var(--size-normal, #{$size-normal}) !default
$message-radius: var(--radius, #{$radius}) !default
2017-07-28 20:05:15 +00:00
2020-08-15 08:36:21 +00:00
$message-header-background-color: var(--text, #{$text}) !default
$message-header-color: var(--text-invert, #{$text-invert}) !default
$message-header-weight: var(--weight-bold, #{$weight-bold}) !default
2018-04-11 15:07:35 +00:00
$message-header-padding: 0.75em 1em !default
2020-08-15 08:36:21 +00:00
$message-header-radius: var(--radius, #{$radius}) !default
2017-07-28 20:05:15 +00:00
2020-08-15 08:36:21 +00:00
$message-body-border-color: var(--border, #{$border}) !default
2018-04-11 15:07:35 +00:00
$message-body-border-width: 0 0 0 4px !default
2020-08-15 08:36:21 +00:00
$message-body-color: var(--text, #{$text}) !default
2018-04-11 15:07:35 +00:00
$message-body-padding: 1.25em 1.5em !default
2020-08-15 08:36:21 +00:00
$message-body-radius: var(--radius, #{$radius}) !default
2017-07-28 20:05:15 +00:00
2020-08-15 08:36:21 +00:00
$message-body-pre-background-color: var(--scheme-main, #{$scheme-main}) !default
2017-07-28 20:05:15 +00:00
$message-body-pre-code-background-color: transparent !default
2018-04-11 15:07:35 +00:00
$message-header-body-border-width: 0 !default
2019-05-17 12:50:39 +00:00
$message-colors: $colors !default
2018-04-11 15:07:35 +00:00
2016-01-24 00:03:43 +00:00
.message
2020-08-15 08:36:21 +00:00
--message-background-color: #{$message-background-color}
--message-font-size: #{$message-font-size}
--message-radius: #{$message-radius}
--message-header-background-color: #{$message-header-background-color}
--message-header-color: #{$message-header-color}
--message-header-weight: #{$message-header-weight}
--message-header-padding: #{$message-header-padding}
--message-body-border-color: #{$message-body-border-color}
--message-body-radius: #{$message-body-radius}
--message-body-border-width: #{$message-body-border-width}
--message-body-color: #{$message-body-color}
--message-body-padding: #{$message-body-padding}
--message-body-pre-background-color: #{$message-body-pre-background-color}
--message-body-pre-code-background-color: #{$message-body-pre-code-background-color}
--message-header-body-border-width: #{$message-header-body-border-width}
2018-09-04 13:24:50 +00:00
@extend %block
2020-08-15 08:36:21 +00:00
background-color: var(--message-background-color)
border-radius: var(--message-radius)
font-size: var(--message-font-size)
2017-09-18 22:02:43 +00:00
strong
color: currentColor
a:not(.button):not(.tag):not(.dropdown-item)
2017-09-18 22:02:43 +00:00
color: currentColor
text-decoration: underline
2017-07-28 20:05:15 +00:00
// Sizes
&.is-small
2020-08-15 08:36:21 +00:00
--message-font-size: var(--size-small, #{$size-small})
2017-07-28 20:05:15 +00:00
&.is-medium
2020-08-15 08:36:21 +00:00
--message-font-size: var(--size-medium, #{$size-medium})
2017-07-28 20:05:15 +00:00
&.is-large
2020-08-15 08:36:21 +00:00
--message-font-size: var(--size-large, #{$size-large})
2016-04-10 15:00:32 +00:00
// Colors
@each $name, $components in $message-colors
$color: nth($components, 1)
$color-invert: nth($components, 2)
$color-light: null
$color-dark: null
2019-10-13 14:12:30 +00:00
@if length($components) >= 3
$color-light: nth($components, 3)
@if length($components) >= 4
$color-dark: nth($components, 4)
@else
$color-luminance: colorLuminance($color)
$darken-percentage: $color-luminance * 70%
$desaturate-percentage: $color-luminance * 30%
$color-dark: desaturate(darken($color, $darken-percentage), $desaturate-percentage)
2019-10-13 14:12:30 +00:00
@else
2020-08-15 07:46:34 +00:00
@if type-of($color) == 'color'
$color-lightning: max((100% - lightness($color)) - 2%, 0%)
$color-light: lighten($color, $color-lightning)
@else
$color-light: $color
2019-10-13 14:12:30 +00:00
2016-01-24 00:03:43 +00:00
&.is-#{$name}
2020-08-15 08:36:21 +00:00
--message-background-color: var(--#{$name}-light, #{$color-light})
--message-header-background-color: var(--#{$name}, #{$color})
--message-header-color: var(--#{$name}-invert, #{$color-invert})
--message-body-border-color: var(--#{$name}, #{$color})
--message-body-color: var(--#{$name}-dark, #{$color-dark})
2016-10-30 19:20:51 +00:00
.message-header
align-items: center
2020-08-15 08:36:21 +00:00
background-color: var(--message-header-background-color)
2017-07-28 20:05:15 +00:00
border-radius: $message-header-radius $message-header-radius 0 0
2020-08-15 08:36:21 +00:00
color: var(--message-header-color)
2016-10-30 19:20:51 +00:00
display: flex
2020-08-15 08:36:21 +00:00
font-weight: var(--message-header-weight)
2016-10-30 19:20:51 +00:00
justify-content: space-between
line-height: 1.25
2020-08-15 08:36:21 +00:00
padding: var(--message-header-padding)
2016-10-30 19:20:51 +00:00
position: relative
.delete
flex-grow: 0
flex-shrink: 0
2020-01-22 09:14:04 +00:00
+ltr-property("margin", 0.75em, false)
2016-10-30 19:20:51 +00:00
& + .message-body
2020-08-15 08:36:21 +00:00
border-width: var(--message-header-body-border-width)
2016-12-23 12:45:52 +00:00
border-top-left-radius: 0
border-top-right-radius: 0
2016-10-30 19:20:51 +00:00
.message-body
2020-08-15 08:36:21 +00:00
border-color: var(--message-body-border-color)
border-radius: var(--message-body-radius)
2018-04-11 15:07:35 +00:00
border-style: solid
2020-08-15 08:36:21 +00:00
border-width: var(--message-body-border-width)
color: var(--message-body-color)
padding: var(--message-body-padding)
2016-10-30 23:44:50 +00:00
code,
pre
2020-08-15 08:36:21 +00:00
background-color: var(--message-body-pre-background-color)
2016-10-30 23:44:50 +00:00
pre code
2020-08-15 08:36:21 +00:00
background-color: var(--message-body-pre-code-background-color)