diff --git a/docs/content/components/labels.md b/docs/content/components/labels.md index b63aa4d7..714e0dc1 100644 --- a/docs/content/components/labels.md +++ b/docs/content/components/labels.md @@ -174,3 +174,26 @@ Counters can also be used in `Box` headers to indicate the number of items in a ``` + +## Diffstat + +Diffstats show how many deletions or additions a diff has. It's typically a row of 5 blocks that get colored with green or red. + +```html live + + 6 + + +``` + +Use the `text-green` and `text-red` utilities to add addtitional information about the size of the diff. + +```html live + + +7 + −2 + + + + +``` diff --git a/src/labels/diffstat.scss b/src/labels/diffstat.scss new file mode 100644 index 00000000..40384863 --- /dev/null +++ b/src/labels/diffstat.scss @@ -0,0 +1,32 @@ +// diffstat +// +// Green/red blocks showing additions and deletions + +.diffstat { + font-size: $h6-size; + font-weight: $font-weight-bold; + color: $text-gray; + white-space: nowrap; + cursor: default; +} + +.diffstat-block-deleted, +.diffstat-block-added, +.diffstat-block-neutral { + display: inline-block; + width: $spacer-2; + height: $spacer-2; + margin-left: 1px; +} + +.diffstat-block-deleted { + background-color: $bg-diffstat-deleted; +} + +.diffstat-block-added { + background-color: $bg-diffstat-added; +} + +.diffstat-block-neutral { + background-color: $bg-diffstat-neutral; +} diff --git a/src/labels/index.scss b/src/labels/index.scss index b34fed10..c8632f8b 100644 --- a/src/labels/index.scss +++ b/src/labels/index.scss @@ -3,3 +3,4 @@ @import "./labels.scss"; @import "./states.scss"; @import "./counters.scss"; +@import "./diffstat.scss"; diff --git a/src/support/variables/colors.scss b/src/support/variables/colors.scss index 7dddeaf3..656ff6b5 100644 --- a/src/support/variables/colors.scss +++ b/src/support/variables/colors.scss @@ -54,6 +54,11 @@ $bg-yellow: $yellow-500 !default; $bg-yellow-light: $yellow-200 !default; $bg-yellow-dark: $yellow-700 !default; +// diffstat background colors +$bg-diffstat-added: darken($green-400, 5%) !default; +$bg-diffstat-deleted: $red-600 !default; +$bg-diffstat-neutral: $gray-300 !default; + // Text colors $text-blue: $blue-500 !default; $text-gray-dark: $gray-900 !default;