Files
bulma/sass/elements/tag.sass

141 lines
3.4 KiB
Sass
Raw Normal View History

2020-10-31 23:52:27 +00:00
@import "../utilities/mixins"
2017-07-28 21:05:15 +01:00
$tag-background-color: $background !default
$tag-color: $text !default
2017-07-28 22:57:51 +01:00
$tag-radius: $radius !default
$tag-delete-margin: 1px !default
2017-07-28 22:57:51 +01:00
$tag-colors: $colors !default
2017-07-28 22:57:51 +01:00
.tags
align-items: center
display: flex
flex-wrap: wrap
justify-content: flex-start
.tag
margin-bottom: 0.5rem
&:not(:last-child)
2020-05-17 19:38:47 +01:00
+ltr-property("margin", 0.5rem)
2017-07-28 22:57:51 +01:00
&:last-child
margin-bottom: -0.5rem
&:not(:last-child)
margin-bottom: 1rem
// Sizes
&.are-medium
2018-10-31 19:22:21 +00:00
.tag:not(.is-normal):not(.is-large)
font-size: $size-normal
&.are-large
2018-10-31 19:22:21 +00:00
.tag:not(.is-normal):not(.is-medium)
font-size: $size-medium
&.is-centered
justify-content: center
.tag
margin-right: 0.25rem
margin-left: 0.25rem
&.is-right
justify-content: flex-end
.tag
&:not(:first-child)
margin-left: 0.5rem
&:not(:last-child)
margin-right: 0
&.has-addons
.tag
2020-05-17 19:38:47 +01:00
+ltr-property("margin", 0)
&:not(:first-child)
2020-05-17 19:38:47 +01:00
+ltr-property("margin", 0, false)
+ltr
border-top-left-radius: 0
border-bottom-left-radius: 0
+rtl
border-top-right-radius: 0
border-bottom-right-radius: 0
&:not(:last-child)
2020-05-17 19:38:47 +01:00
+ltr
border-top-right-radius: 0
border-bottom-right-radius: 0
+rtl
border-top-left-radius: 0
border-bottom-left-radius: 0
2017-07-28 21:05:15 +01:00
2017-08-21 14:29:03 -04:00
.tag:not(body)
2016-10-30 10:41:53 +00:00
align-items: center
2017-07-28 21:05:15 +01:00
background-color: $tag-background-color
2017-07-28 22:57:51 +01:00
border-radius: $tag-radius
2017-07-28 21:05:15 +01:00
color: $tag-color
2016-10-30 10:41:53 +00:00
display: inline-flex
font-size: $size-small
height: 2em
justify-content: center
line-height: 1.5
2017-07-28 22:57:51 +01:00
padding-left: 0.75em
padding-right: 0.75em
2016-10-30 10:41:53 +00:00
white-space: nowrap
.delete
2020-05-17 19:38:47 +01:00
+ltr-property("margin", 0.25rem, false)
+ltr-property("margin", -0.375rem)
2016-10-30 10:41:53 +00:00
// Colors
@each $name, $pair in $tag-colors
2016-10-30 10:41:53 +00:00
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
2019-10-13 15:12:30 +01:00
// If a light and dark colors are provided
@if length($pair) > 3
$color-light: nth($pair, 3)
$color-dark: nth($pair, 4)
&.is-light
background-color: $color-light
color: $color-dark
2016-10-30 10:41:53 +00:00
// Sizes
2018-10-31 19:22:21 +00:00
&.is-normal
font-size: $size-small
2016-10-30 10:41:53 +00:00
&.is-medium
font-size: $size-normal
&.is-large
font-size: $size-medium
2017-10-18 20:39:34 +11:00
.icon
&:first-child:not(:last-child)
2020-05-17 19:38:47 +01:00
+ltr-property("margin", -0.375em, false)
+ltr-property("margin", 0.1875em)
2017-10-18 20:39:34 +11:00
&:last-child:not(:first-child)
2020-05-17 19:38:47 +01:00
+ltr-property("margin", 0.1875em, false)
+ltr-property("margin", -0.375em)
2017-10-18 20:39:34 +11:00
&:first-child:last-child
2020-05-17 19:38:47 +01:00
+ltr-property("margin", -0.375em, false)
+ltr-property("margin", -0.375em)
2017-07-28 22:57:51 +01:00
// Modifiers
2017-07-29 15:31:19 +01:00
&.is-delete
2020-05-17 19:38:47 +01:00
+ltr-property("margin", $tag-delete-margin, false)
2017-07-29 15:31:19 +01:00
padding: 0
position: relative
width: 2em
2018-04-08 19:08:39 +01:00
&::before,
&::after
2017-07-29 15:31:19 +01:00
background-color: currentColor
content: ""
display: block
left: 50%
position: absolute
top: 50%
transform: translateX(-50%) translateY(-50%) rotate(45deg)
transform-origin: center center
2018-04-08 19:08:39 +01:00
&::before
2017-07-29 15:31:19 +01:00
height: 1px
width: 50%
2018-04-08 19:08:39 +01:00
&::after
2017-07-29 15:31:19 +01:00
height: 50%
width: 1px
&:hover,
&:focus
background-color: darken($tag-background-color, 5%)
&:active
background-color: darken($tag-background-color, 10%)
2017-07-28 22:57:51 +01:00
&.is-rounded
border-radius: $radius-rounded
2017-07-28 22:57:51 +01:00
a.tag
&:hover
text-decoration: underline