0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/site/assets/scss/_component-examples.scss
Mark Otto 3362c8cf13
Do some CSS and Migration guide cleanup (#36191)
* Do some CSS and Migration guide cleanup

- More code snippet tweaks
- Fix some homepage hero bugs
- Do a cleanup on Migration guide content to highlight more changes and fix some issues from merge conflicts
2022-04-18 20:56:18 -07:00

399 lines
6.2 KiB
SCSS

//
// Grid examples
//
.bd-example-row {
.row {
> .col,
> [class^="col-"] {
padding-top: .75rem;
padding-bottom: .75rem;
background-color: rgba(39, 41, 43, .03);
border: 1px solid rgba(39, 41, 43, .1);
}
}
.row + .row {
margin-top: 1rem;
}
}
.bd-example-row-flex-cols .row {
min-height: 10rem;
background-color: rgba(255, 0, 0, .1);
}
.bd-example-cssgrid {
text-align: center;
.grid + .grid {
margin-top: 1rem;
}
.grid > * {
padding-top: .75rem;
padding-bottom: .75rem;
background-color: rgba(255, 0, 255, .1);
border: 1px solid rgba(255, 0, 255, .25);
}
}
.bd-highlight {
background-color: rgba($bd-purple, .15);
border: 1px solid rgba($bd-purple, .15);
}
// Grid mixins
.example-container {
width: 800px;
@include make-container();
}
.example-row {
@include make-row();
}
.example-content-main {
@include make-col-ready();
@include media-breakpoint-up(sm) {
@include make-col(6);
}
@include media-breakpoint-up(lg) {
@include make-col(8);
}
}
.example-content-secondary {
@include make-col-ready();
@include media-breakpoint-up(sm) {
@include make-col(6);
}
@include media-breakpoint-up(lg) {
@include make-col(4);
}
}
//
// Docs examples
//
.bd-example-snippet {
border: solid $border-color;
border-width: 1px 0;
@include media-breakpoint-up(md) {
border-width: 1px;
}
}
.bd-example {
position: relative;
padding: 1rem;
@include clearfix();
@include media-breakpoint-up(md) {
padding: 1.5rem;
@include border-top-radius(var(--bs-border-radius));
}
+ p {
margin-top: 2rem;
}
> .form-control {
+ .form-control {
margin-top: .5rem;
}
}
> .nav + .nav,
> .alert + .alert,
> .navbar + .navbar,
> .progress + .progress {
margin-top: 1rem;
}
> .dropdown-menu {
position: static;
display: block;
}
> :last-child {
margin-bottom: 0;
}
> hr:last-child {
margin-bottom: $spacer;
}
// Images
> svg + svg,
> img + img {
margin-left: .5rem;
}
// Buttons
> .btn,
> .btn-group {
margin: .25rem .125rem;
}
> .btn-toolbar + .btn-toolbar {
margin-top: .5rem;
}
// List groups
> .list-group {
max-width: 400px;
}
> [class*="list-group-horizontal"] {
max-width: 100%;
}
// Navbars
.fixed-top,
.sticky-top {
position: static;
margin: -1rem -1rem 1rem;
}
.fixed-bottom,
.sticky-bottom {
position: static;
margin: 1rem -1rem -1rem;
}
@include media-breakpoint-up(sm) {
.fixed-top,
.sticky-top {
margin: -1.5rem -1.5rem 1rem;
}
.fixed-bottom,
.sticky-bottom {
margin: 1rem -1.5rem -1.5rem;
}
}
// Pagination
.pagination {
margin-top: .5rem;
margin-bottom: .5rem;
}
}
// Ratio helpers
.bd-example-ratios {
.ratio {
display: inline-block;
width: 10rem;
color: $gray-600;
background-color: $gray-100;
border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color);
> div {
display: flex;
align-items: center;
justify-content: center;
}
}
}
.bd-example-ratios-breakpoint {
.ratio-4x3 {
width: 16rem;
@include media-breakpoint-up(md) {
--bs-aspect-ratio: 50%; // 2x1
}
}
}
.bd-example-modal {
background-color: #fafafa;
.modal {
position: static;
display: block;
}
}
.bd-example-offcanvas {
@include border-start-radius(0);
.offcanvas {
position: static;
display: block;
height: 200px;
visibility: visible;
transform: translate(0);
}
}
// Tooltips
.tooltip-demo a {
white-space: nowrap;
}
.custom-tooltip {
--bs-tooltip-bg: var(--bs-primary);
}
// scss-docs-start custom-popovers
.custom-popover {
--bs-popover-max-width: 200px;
--bs-popover-border-color: var(--bs-primary);
--bs-popover-header-bg: var(--bs-primary);
--bs-popover-header-color: var(--bs-white);
--bs-popover-body-padding-x: 1rem;
--bs-popover-body-padding-y: .5rem;
}
// scss-docs-end custom-popovers
// Scrollspy demo on fixed height div
.scrollspy-example {
height: 200px;
margin-top: .5rem;
overflow: auto;
}
.scrollspy-example-2 {
height: 350px;
overflow: auto;
}
.simple-list-example-scrollspy {
a {
padding: .25rem;
margin: .5rem 0;
&:focus {
background-color: rgba($bd-purple, .65);
}
}
.active {
background-color: rgba($bd-purple, .15);
}
}
.bd-example-border-utils {
[class^="border"] {
display: inline-block;
width: 5rem;
height: 5rem;
margin: .25rem;
background-color: #f5f5f5;
}
}
.bd-example-border-utils-0 {
[class^="border"] {
border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color);
}
}
.bd-example-rounded-utils {
[class*="rounded"] {
margin: .25rem;
}
}
.bd-example-position-utils {
position: relative;
padding: 3em;
.position-relative {
height: 200px;
background-color: #f5f5f5;
}
.position-absolute {
width: 2em;
height: 2em;
background-color: $dark;
@include border-radius();
}
}
.bd-example-position-examples {
&::after {
content: none;
}
}
// Placeholders
.bd-example-placeholder-cards {
&::after {
display: none;
}
.card {
width: 18rem;
}
}
// Toasts
.bd-example-toasts {
min-height: 240px;
}
//
// Code snippets
//
.highlight {
position: relative;
padding: .75rem ($bd-gutter-x * .5);
margin-bottom: 1rem;
background-color: var(--bs-gray-100);
@include media-breakpoint-up(md) {
padding: .75rem 1.25rem;
@include border-radius(var(--bs-border-radius));
}
pre {
padding: 0;
margin-top: .65rem;
margin-bottom: .65rem;
white-space: pre;
background-color: transparent;
border: 0;
// Undo tabindex that's automatically added by Hugo
&:focus {
outline: 0;
}
}
pre code {
@include font-size(inherit);
color: $gray-900; // Effectively the base text color
word-wrap: normal;
}
}
.bd-code-snippet {
margin: $spacer ($bd-gutter-x * -.5);
.highlight {
margin-bottom: 0;
}
@include media-breakpoint-up(md) {
margin-right: 0;
margin-left: 0;
@include border-radius($border-radius);
}
}
.highlight-toolbar {
border: solid $border-color;
border-width: 1px 0;
}