bulma/sass/components/message.sass

103 lines
3.1 KiB
Sass
Raw Normal View History

2017-07-28 20:05:15 +00:00
$message-background-color: $background !default
$message-radius: $radius !default
$message-header-background-color: $text !default
$message-header-color: $text-invert !default
2018-04-11 15:07:35 +00:00
$message-header-weight: $weight-bold !default
$message-header-padding: 0.75em 1em !default
2017-07-28 20:05:15 +00:00
$message-header-radius: $radius !default
2018-04-11 15:07:35 +00:00
$message-body-border-color: $border !default
$message-body-border-width: 0 0 0 4px !default
2017-07-28 20:05:15 +00:00
$message-body-color: $text !default
2018-04-11 15:07:35 +00:00
$message-body-padding: 1.25em 1.5em !default
2017-07-28 20:05:15 +00:00
$message-body-radius: $radius !default
2019-10-13 14:12:30 +00:00
$message-body-pre-background-color: $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
2018-09-04 13:24:50 +00:00
@extend %block
2017-07-28 20:05:15 +00:00
background-color: $message-background-color
border-radius: $message-radius
2016-10-30 19:20:51 +00:00
font-size: $size-normal
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
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $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}
background-color: var(--#{$name}-light, #{$color-light})
2016-01-24 00:03:43 +00:00
.message-header
background-color: var(--#{$name}, #{$color})
color: var(--#{$name}-invert, #{$color-invert})
2016-01-24 00:03:43 +00:00
.message-body
border-color: var(--#{$name}, #{$color})
color: var(--#{$name}-dark, #{$color-dark})
2016-10-30 19:20:51 +00:00
.message-header
align-items: center
2017-07-28 20:05:15 +00:00
background-color: $message-header-background-color
border-radius: $message-header-radius $message-header-radius 0 0
color: $message-header-color
2016-10-30 19:20:51 +00:00
display: flex
2018-04-11 15:07:35 +00:00
font-weight: $message-header-weight
2016-10-30 19:20:51 +00:00
justify-content: space-between
line-height: 1.25
2017-07-28 20:05:15 +00:00
padding: $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
2018-04-11 15:07:35 +00:00
border-width: $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
2018-04-11 15:07:35 +00:00
border-color: $message-body-border-color
2017-07-28 20:05:15 +00:00
border-radius: $message-body-radius
2018-04-11 15:07:35 +00:00
border-style: solid
border-width: $message-body-border-width
2017-07-28 20:05:15 +00:00
color: $message-body-color
padding: $message-body-padding
2016-10-30 23:44:50 +00:00
code,
pre
2017-07-28 20:05:15 +00:00
background-color: $message-body-pre-background-color
2016-10-30 23:44:50 +00:00
pre code
2017-07-28 20:05:15 +00:00
background-color: $message-body-pre-code-background-color