Files
FixIt/assets/css/_shortcodes/_admonition.scss
T
Cell 56836eb077 feat: add tabs and tab shortcodes support (#634)
* feat: add tabs and tab shortcodes support

Powered by https://github.com/github/tab-container-element

* fix: adjust tab-container styles for improved layout and responsiveness

- [x] Underline Style (Default)
- [x] Pill Style
- [x] Card Style
- [x] Segment Style

* test: add tabs comprehensive test cases

* style: code optimization

* fix: add tabs support in home scope

* docs: add `<tab-container>` element reference to README files

* feat: enhance tab-container with loading mixin and simplify code

* refactor: update variable references to use root prefix in styles

* docs: add tabs shortcode support to README files

* fix: ensure shortcode is enclosed within a tabs block

* feat: add responsive design for tab-container on smaller screens

* test: remove unnecessary placement attribute for segment tabs

* refactor: remove unused vertical attribute from tabs shortcode

* fix: set default tab type to 'underline' for consistency

* refactor: update tab-button and tab-panel selectors for improved specificity
2025-09-11 22:59:33 +08:00

92 lines
2.3 KiB
SCSS

.admonition {
position: relative;
margin: 1rem 0;
padding: 0 0.75rem;
border-left: .25rem solid;
overflow: hidden;
@include border-radius($global-border-radius);
.admonition-title {
font-weight: var(--admonition-title-font-weight, bold);
margin: 0 -0.75rem;
padding: 0.25rem 1.8rem;
border-bottom: 1px solid;
@include border-radius(0);
strong {
font-weight: bolder;
text-shadow: 0 0.05rem 0.05rem rgba(0, 0, 0, 0.2);
[data-theme='dark'] & {
text-shadow: 0 0.05rem 0.05rem rgba(255, 255, 255, 0.2);
}
}
&:has(+ .details-content > .admonition-content:empty) {
--admonition-title-font-weight: normal;
}
}
.admonition-content {
padding: 0.5rem 0;
// for extended alert syntax
> p {
margin: 0;
}
// title-only alert
&:empty {
display: none;
}
}
i.icon {
font-size: 0.85rem;
position: absolute;
top: 0.6rem;
left: 0.4rem;
}
i.details-icon {
position: absolute;
top: 0.6rem;
right: 0.3rem;
}
background-color: var(#{$rootPrefix}admonition-bg-color);
border-left-color: var(#{$rootPrefix}admonition-color);
> .admonition-title {
border-bottom-color: var(#{$rootPrefix}admonition-bg-color);
background-color: var(#{$rootPrefix}admonition-bg-color-collapsed);
i.icon {
color: var(#{$rootPrefix}admonition-color);
}
}
&.open > .admonition-title {
background-color: var(#{$rootPrefix}admonition-bg-color);
}
// default admonition type is note
#{$rootPrefix}admonition-color: #{map-get(map-get($admonition-color-map, note), color)};
#{$rootPrefix}admonition-bg-color: #{map-get(map-get($admonition-color-map, note), bg-color)};
#{$rootPrefix}admonition-bg-color-collapsed: #{opacify(map-get(map-get($admonition-color-map, note), bg-color), 0.15)};
// set color for each admonition type
@each $type, $item in $admonition-color-map {
@if $type != 'note' {
&.#{$type} {
#{$rootPrefix}admonition-color: #{map-get($item, color)};
#{$rootPrefix}admonition-bg-color: #{map-get($item, bg-color)};
#{$rootPrefix}admonition-bg-color-collapsed: #{opacify(map-get($item, bg-color), 0.15)};
}
}
}
&:last-child {
margin-bottom: 0.75rem;
}
}