]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
docs(examples): use RTLCSS for RTL examples
authorGaël Poupard <gael.poupard@orange.com>
Mon, 23 Nov 2020 16:50:45 +0000 (18:50 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Fri, 4 Dec 2020 05:52:03 +0000 (07:52 +0200)
16 files changed:
package.json
site/content/docs/5.0/examples/blog-rtl/blog-rtl.css [deleted file]
site/content/docs/5.0/examples/blog-rtl/index.html
site/content/docs/5.0/examples/blog/blog.css
site/content/docs/5.0/examples/blog/blog.rtl.css [new file with mode: 0644]
site/content/docs/5.0/examples/carousel-rtl/carousel-rtl.css [deleted file]
site/content/docs/5.0/examples/carousel-rtl/index.html
site/content/docs/5.0/examples/carousel/carousel.css
site/content/docs/5.0/examples/carousel/carousel.rtl.css [new file with mode: 0644]
site/content/docs/5.0/examples/cheatsheet-rtl/index.html
site/content/docs/5.0/examples/cheatsheet/cheatsheet.css
site/content/docs/5.0/examples/cheatsheet/cheatsheet.rtl.css [new file with mode: 0644]
site/content/docs/5.0/examples/dashboard-rtl/dashboard-rtl.css [deleted file]
site/content/docs/5.0/examples/dashboard-rtl/index.html
site/content/docs/5.0/examples/dashboard/dashboard.css
site/content/docs/5.0/examples/dashboard/dashboard.rtl.css [new file with mode: 0644]

index 76bb93d4a00b5f9d786f69b6a200a107799766b3..5d4a9a4b4c0549f222c10de7ba2a39360928b645 100644 (file)
@@ -32,6 +32,7 @@
     "css-prefix": "npm-run-all --parallel css-prefix-*",
     "css-prefix-main": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.rtl*.css\" \"!dist/css/*.min.css\"",
     "css-prefix-examples": "postcss --config build/postcss.config.js --replace \"site/content/**/*.css\"",
+    "css-prefix-examples-rtl": "cross-env NODE_ENV=RTL postcss --config build/postcss.config.js --dir \"site/content/docs/$npm_package_version_short/examples/\" --ext \".rtl.css\" --base \"site/content/docs/$npm_package_version_short/examples/\" \"site/content/docs/$npm_package_version_short/examples/{blog,carousel,dashboard,cheatsheet}/*.css\" \"!site/content/docs/$npm_package_version_short/examples/{blog,carousel,dashboard,cheatsheet}/*.rtl.css\"",
     "js": "npm-run-all js-compile js-minify",
     "js-compile": "npm-run-all --parallel js-compile-*",
     "js-compile-standalone": "rollup --environment BUNDLE:false --config build/rollup.config.js --sourcemap",
diff --git a/site/content/docs/5.0/examples/blog-rtl/blog-rtl.css b/site/content/docs/5.0/examples/blog-rtl/blog-rtl.css
deleted file mode 100644 (file)
index 5d6eb0c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* stylelint-disable selector-list-comma-newline-after */
-
-.blog-header-logo,
-h1, h2, h3, h4, h5, h6 {
-  font-family: Amiri, Georgia, "Times New Roman", serif;
-}
index 8de45fa961952139b73c216c1378c966c4d890ff..883ef7b445390b36dea610fe7d773efc087daac5 100644 (file)
@@ -4,8 +4,7 @@ title: قالب المدونة
 direction: rtl
 extra_css:
   - "https://fonts.googleapis.com/css?family=Amiri:wght@400;700&display=swap"
-  - "../blog/blog.css"
-  - "blog-rtl.css"
+  - "../blog/blog.rtl.css"
 include_js: false
 ---
 
index e22653131279dc9b3f02795e8607c0a44162b0a4..437a540f6abc9e088e242d0e9115a981fe2d80a4 100644 (file)
@@ -6,7 +6,7 @@
 }
 
 .blog-header-logo {
-  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
+  font-family: "Playfair Display", Georgia, "Times New Roman", serif/*rtl:Amiri, Georgia, "Times New Roman", serif*/;
   font-size: 2.25rem;
 }
 
@@ -15,7 +15,7 @@
 }
 
 h1, h2, h3, h4, h5, h6 {
-  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
+  font-family: "Playfair Display", Georgia, "Times New Roman", serif/*rtl:Amiri, Georgia, "Times New Roman", serif*/;
 }
 
 .display-4 {
diff --git a/site/content/docs/5.0/examples/blog/blog.rtl.css b/site/content/docs/5.0/examples/blog/blog.rtl.css
new file mode 100644 (file)
index 0000000..35eac73
--- /dev/null
@@ -0,0 +1,103 @@
+/* stylelint-disable selector-list-comma-newline-after */
+
+.blog-header {
+  line-height: 1;
+  border-bottom: 1px solid #e5e5e5;
+}
+
+.blog-header-logo {
+  font-family: Amiri, Georgia, "Times New Roman", serif;
+  font-size: 2.25rem;
+}
+
+.blog-header-logo:hover {
+  text-decoration: none;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  font-family: Amiri, Georgia, "Times New Roman", serif;
+}
+
+.display-4 {
+  font-size: 2.5rem;
+}
+@media (min-width: 768px) {
+  .display-4 {
+    font-size: 3rem;
+  }
+}
+
+.nav-scroller {
+  position: relative;
+  z-index: 2;
+  height: 2.75rem;
+  overflow-y: hidden;
+}
+
+.nav-scroller .nav {
+  display: flex;
+  flex-wrap: nowrap;
+  padding-bottom: 1rem;
+  margin-top: -1px;
+  overflow-x: auto;
+  text-align: center;
+  white-space: nowrap;
+  -webkit-overflow-scrolling: touch;
+}
+
+.nav-scroller .nav-link {
+  padding-top: .75rem;
+  padding-bottom: .75rem;
+  font-size: .875rem;
+}
+
+.card-img-right {
+  height: 100%;
+  border-radius: 3px 0 0 3px;
+}
+
+.flex-auto {
+  flex: 0 0 auto;
+}
+
+.h-250 { height: 250px; }
+@media (min-width: 768px) {
+  .h-md-250 { height: 250px; }
+}
+
+/* Pagination */
+.blog-pagination {
+  margin-bottom: 4rem;
+}
+.blog-pagination > .btn {
+  border-radius: 2rem;
+}
+
+/*
+ * Blog posts
+ */
+.blog-post {
+  margin-bottom: 4rem;
+}
+.blog-post-title {
+  margin-bottom: .25rem;
+  font-size: 2.5rem;
+}
+.blog-post-meta {
+  margin-bottom: 1.25rem;
+  color: #727272;
+}
+
+/*
+ * Footer
+ */
+.blog-footer {
+  padding: 2.5rem 0;
+  color: #727272;
+  text-align: center;
+  background-color: #f9f9f9;
+  border-top: .05rem solid #e5e5e5;
+}
+.blog-footer p:last-child {
+  margin-bottom: 0;
+}
diff --git a/site/content/docs/5.0/examples/carousel-rtl/carousel-rtl.css b/site/content/docs/5.0/examples/carousel-rtl/carousel-rtl.css
deleted file mode 100644 (file)
index b769650..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.carousel-item > img {
-  right: 0;
-  left: auto;
-}
-
-.featurette-heading {
-  letter-spacing: normal;
-}
index 89b470b9965c89c1ccc390cc08cbcc688af9f4e8..7555fc783668bb15e9b89d3de068c2a9b3aa70bf 100644 (file)
@@ -3,8 +3,7 @@ layout: examples
 title: قالب دائري
 direction: rtl
 extra_css:
-  - "../carousel/carousel.css"
-  - "carousel-rtl.css"
+  - "../carousel/carousel.rtl.css"
 ---
 
 <header>
index 20300e90c64d87878427ab82501cb0c183247b5f..f91faec769e2f8d1e88109dbc20dfe0257ddbe51 100644 (file)
@@ -46,10 +46,12 @@ body {
 .marketing h2 {
   font-weight: 400;
 }
+/* rtl:begin:ignore */
 .marketing .col-lg-4 p {
   margin-right: .75rem;
   margin-left: .75rem;
 }
+/* rtl:end:ignore */
 
 
 /* Featurettes
@@ -63,6 +65,7 @@ body {
 .featurette-heading {
   font-weight: 300;
   line-height: 1;
+  /* rtl:remove */
   letter-spacing: -.05rem;
 }
 
diff --git a/site/content/docs/5.0/examples/carousel/carousel.rtl.css b/site/content/docs/5.0/examples/carousel/carousel.rtl.css
new file mode 100644 (file)
index 0000000..853640b
--- /dev/null
@@ -0,0 +1,89 @@
+/* GLOBAL STYLES
+-------------------------------------------------- */
+/* Padding below the footer and lighter body text */
+
+body {
+  padding-top: 3rem;
+  padding-bottom: 3rem;
+  color: #5a5a5a;
+}
+
+
+/* CUSTOMIZE THE CAROUSEL
+-------------------------------------------------- */
+
+/* Carousel base class */
+.carousel {
+  margin-bottom: 4rem;
+}
+/* Since positioning the image, we need to help out the caption */
+.carousel-caption {
+  bottom: 3rem;
+  z-index: 10;
+}
+
+/* Declare heights because of positioning of img element */
+.carousel-item {
+  height: 32rem;
+}
+.carousel-item > img {
+  position: absolute;
+  top: 0;
+  right: 0;
+  min-width: 100%;
+  height: 32rem;
+}
+
+
+/* MARKETING CONTENT
+-------------------------------------------------- */
+
+/* Center align the text within the three columns below the carousel */
+.marketing .col-lg-4 {
+  margin-bottom: 1.5rem;
+  text-align: center;
+}
+.marketing h2 {
+  font-weight: 400;
+}
+.marketing .col-lg-4 p {
+  margin-right: .75rem;
+  margin-left: .75rem;
+}
+
+
+/* Featurettes
+------------------------- */
+
+.featurette-divider {
+  margin: 5rem 0; /* Space out the Bootstrap <hr> more */
+}
+
+/* Thin out the marketing headings */
+.featurette-heading {
+  font-weight: 300;
+  line-height: 1;
+}
+
+
+/* RESPONSIVE CSS
+-------------------------------------------------- */
+
+@media (min-width: 40em) {
+  /* Bump up size of carousel content */
+  .carousel-caption p {
+    margin-bottom: 1.25rem;
+    font-size: 1.25rem;
+    line-height: 1.4;
+  }
+
+  .featurette-heading {
+    font-size: 50px;
+  }
+}
+
+@media (min-width: 62em) {
+  .featurette-heading {
+    margin-top: 7rem;
+  }
+}
index e4b046c514eb55a2c285e6da77e38f30350ae09f..c5561272f2f3579928f76ffb1ee531bd1440b034 100644 (file)
@@ -2,7 +2,7 @@
 layout: examples
 title: ورقة غش
 extra_css:
-- "../cheatsheet/cheatsheet.css"
+- "../cheatsheet/cheatsheet.rtl.css"
 extra_js:
 - src: "../cheatsheet/cheatsheet.js"
 body_class: "bg-light"
index 26289b790e33e61037e319862f6f1577b39826af..a67becc5c9d66125b5daa2b859ff15e01f11a7a9 100644 (file)
@@ -16,11 +16,6 @@ body {
   background-size: 1em;
 }
 
-[dir="rtl"] .bd-heading a::before {
-  margin-right: 0;
-  margin-left: .25rem;
-}
-
 /* stylelint-disable-next-line selector-max-universal */
 .bd-heading + div > * + * {
   margin-top: 3rem;
@@ -40,11 +35,6 @@ body {
   margin-left: -1rem;
 }
 
-[dir="rtl"] .bd-aside a:not(:only-child) {
-  margin-right: -1rem;
-  margin-left: auto;
-}
-
 .bd-aside a:not(:only-child)::before {
   width: 1rem;
   line-height: 0;
@@ -86,18 +76,6 @@ body {
   margin: 0 1rem 1rem 0;
 }
 
-[dir="rtl"] [id="modal"] .bd-example .btn,
-[dir="rtl"] [id="buttons"] .bd-example .btn,
-[dir="rtl"] [id="tooltips"] .bd-example .btn,
-[dir="rtl"] [id="popovers"] .bd-example .btn,
-[dir="rtl"] [id="dropdowns"] .bd-example .btn-group,
-[dir="rtl"] [id="dropdowns"] .bd-example .dropdown,
-[dir="rtl"] [id="dropdowns"] .bd-example .dropup,
-[dir="rtl"] [id="dropdowns"] .bd-example .dropend,
-[dir="rtl"] [id="dropdowns"] .bd-example .dropstart {
-  margin: 0 0 1rem 1rem;
-}
-
 /* Layout */
 @media (min-width: 1200px) {
   body {
@@ -110,8 +88,10 @@ body {
   .bd-header {
     position: fixed;
     top: 0;
+    /* rtl:begin:ignore */
     right: 0;
     left: 0;
+    /* rtl:end:ignore */
     z-index: 1030;
     grid-column: 1 / span 3;
     min-height: 6rem;
diff --git a/site/content/docs/5.0/examples/cheatsheet/cheatsheet.rtl.css b/site/content/docs/5.0/examples/cheatsheet/cheatsheet.rtl.css
new file mode 100644 (file)
index 0000000..91572b3
--- /dev/null
@@ -0,0 +1,151 @@
+body {
+  scroll-behavior: smooth;
+}
+
+/**
+ * Bootstrap "Journal code" icon
+ * @link https://icons.getbootstrap.com/icons/journal-code/
+ */
+.bd-heading a::before {
+  display: inline-block;
+  width: 1em;
+  height: 1em;
+  margin-left: .25rem;
+  content: "";
+  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%25230d6efd' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h8a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2h1a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1H2a2 2 0 0 1 2-2z'/%3E%3Cpath d='M2 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H2zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H2zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H2z'/%3E%3Cpath fill-rule='evenodd' d='M8.646 5.646a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L10.293 8 8.646 6.354a.5.5 0 0 1 0-.708zm-1.292 0a.5.5 0 0 0-.708 0l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708L5.707 8l1.647-1.646a.5.5 0 0 0 0-.708z'/%3E%3C/svg%3E");
+  background-size: 1em;
+}
+
+/* stylelint-disable-next-line selector-max-universal */
+.bd-heading + div > * + * {
+  margin-top: 3rem;
+}
+
+/* Table of contents */
+.bd-aside a {
+  padding: .125rem 1rem;
+  color: inherit;
+}
+
+.bd-aside a:not(:hover) {
+  text-decoration: none;
+}
+
+.bd-aside a:not(:only-child) {
+  margin-right: -1rem;
+}
+
+.bd-aside a:not(:only-child)::before {
+  width: 1rem;
+  line-height: 0;
+  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
+  transition: transform .35s ease;
+  transform-origin: .5em 50%;
+}
+
+.bd-aside a:not(:only-child):not(.collapsed) {
+  color: #000;
+}
+
+.bd-aside a:not(:only-child):not(.collapsed)::before {
+  transform: rotate(-90deg);
+}
+
+.bd-aside .active {
+  font-weight: 700;
+  color: #000;
+}
+
+/* Examples */
+.scrollspy-example {
+  position: relative;
+  height: 200px;
+  margin-top: .5rem;
+  overflow: auto;
+}
+
+[id="modal"] .bd-example .btn,
+[id="buttons"] .bd-example .btn,
+[id="tooltips"] .bd-example .btn,
+[id="popovers"] .bd-example .btn,
+[id="dropdowns"] .bd-example .btn-group,
+[id="dropdowns"] .bd-example .dropdown,
+[id="dropdowns"] .bd-example .dropup,
+[id="dropdowns"] .bd-example .dropend,
+[id="dropdowns"] .bd-example .dropstart {
+  margin: 0 0 1rem 1rem;
+}
+
+/* Layout */
+@media (min-width: 1200px) {
+  body {
+    display: grid;
+    gap: 1rem;
+    grid-template-columns: 1fr 4fr 1fr;
+    grid-template-rows: auto;
+  }
+
+  .bd-header {
+    position: fixed;
+    top: 0;
+    right: 0;
+    left: 0;
+    z-index: 1030;
+    grid-column: 1 / span 3;
+    min-height: 6rem;
+  }
+
+  .bd-aside,
+  .bd-cheatsheet {
+    padding-top: 6rem;
+  }
+
+  /**
+   * 1. Too bad only Firefox supports subgrids ATM
+   */
+  .bd-cheatsheet,
+  .bd-cheatsheet section,
+  .bd-cheatsheet article {
+    display: inherit; /* 1 */
+    gap: inherit; /* 1 */
+    grid-template-columns: 1fr 4fr;
+    grid-column: 1 / span 2;
+    grid-template-rows: auto;
+  }
+
+  .bd-aside {
+    grid-area: 1 / 3;
+    scroll-margin-top: 6rem;
+  }
+
+  .bd-cheatsheet section,
+  .bd-cheatsheet section > h2 {
+    top: 6rem;
+    scroll-margin-top: 6rem;
+  }
+
+  .bd-cheatsheet section > h2 {
+    background-image: linear-gradient(to bottom, #fff, transparent);
+    grid-column: 1 / span 2;
+  }
+
+  .bd-cheatsheet section > h2::before {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    z-index: -1;
+    width: 17.5%;
+    content: "";
+    background-image: linear-gradient(to bottom, #fff calc(100% - 2rem), transparent);
+  }
+
+  .bd-cheatsheet article,
+  .bd-cheatsheet .bd-heading {
+    top: 12rem;
+    scroll-margin-top: 12rem;
+  }
+
+  .bd-cheatsheet .bd-heading {
+    z-index: 1;
+  }
+}
diff --git a/site/content/docs/5.0/examples/dashboard-rtl/dashboard-rtl.css b/site/content/docs/5.0/examples/dashboard-rtl/dashboard-rtl.css
deleted file mode 100644 (file)
index fb18d90..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-.sidebar {
-  right: 0;
-  left: auto;
-}
-
-.sidebar .nav-link .feather {
-  margin-right: 0;
-  margin-left: 4px;
-}
-
-.navbar .navbar-toggler {
-  right: auto;
-  left: 1rem;
-}
index cfd28a45149e4d085d7090141ee5867a9778d9c8..848c67c0b9ca6b478e5ad6fa7a5986e2741cc9c4 100644 (file)
@@ -3,8 +3,7 @@ layout: examples
 title: قالب لوحة القيادة
 direction: rtl
 extra_css:
-  - "../dashboard/dashboard.css"
-  - "dashboard-rtl.css"
+  - "../dashboard/dashboard.rtl.css"
 extra_js:
   - src: "https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.24.1/feather.min.js"
     integrity: "sha384-EbSscX4STvYAC/DxHse8z5gEDaNiKAIGW+EpfzYTfQrgIlHywXXrM9SUIZ0BlyfF"
index 7e3ac226d34e85c714f895fe3098a82bc06610cd..8b0fa7253b5b505306cfda42e827385c913c9016 100644 (file)
@@ -15,7 +15,11 @@ body {
 .sidebar {
   position: fixed;
   top: 0;
+  /* rtl:raw:
+  right: 0;
+  */
   bottom: 0;
+  /* rtl:remove */
   left: 0;
   z-index: 100; /* Behind the navbar */
   padding: 48px 0 0; /* Height of navbar */
diff --git a/site/content/docs/5.0/examples/dashboard/dashboard.rtl.css b/site/content/docs/5.0/examples/dashboard/dashboard.rtl.css
new file mode 100644 (file)
index 0000000..2406ce5
--- /dev/null
@@ -0,0 +1,96 @@
+body {
+  font-size: .875rem;
+}
+
+.feather {
+  width: 16px;
+  height: 16px;
+  vertical-align: text-bottom;
+}
+
+/*
+ * Sidebar
+ */
+
+.sidebar {
+  position: fixed;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  z-index: 100; /* Behind the navbar */
+  padding: 48px 0 0; /* Height of navbar */
+  box-shadow: inset 1px 0 0 rgba(0, 0, 0, .1);
+}
+
+@media (max-width: 767.98px) {
+  .sidebar {
+    top: 5rem;
+  }
+}
+
+.sidebar-sticky {
+  position: relative;
+  top: 0;
+  height: calc(100vh - 48px);
+  padding-top: .5rem;
+  overflow-x: hidden;
+  overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
+}
+
+.sidebar .nav-link {
+  font-weight: 500;
+  color: #333;
+}
+
+.sidebar .nav-link .feather {
+  margin-left: 4px;
+  color: #727272;
+}
+
+.sidebar .nav-link.active {
+  color: #007bff;
+}
+
+.sidebar .nav-link:hover .feather,
+.sidebar .nav-link.active .feather {
+  color: inherit;
+}
+
+.sidebar-heading {
+  font-size: .75rem;
+  text-transform: uppercase;
+}
+
+/*
+ * Navbar
+ */
+
+.navbar-brand {
+  padding-top: .75rem;
+  padding-bottom: .75rem;
+  font-size: 1rem;
+  background-color: rgba(0, 0, 0, .25);
+  box-shadow: inset 1px 0 0 rgba(0, 0, 0, .25);
+}
+
+.navbar .navbar-toggler {
+  top: .25rem;
+  left: 1rem;
+}
+
+.navbar .form-control {
+  padding: .75rem 1rem;
+  border-width: 0;
+  border-radius: 0;
+}
+
+.form-control-dark {
+  color: #fff;
+  background-color: rgba(255, 255, 255, .1);
+  border-color: rgba(255, 255, 255, .1);
+}
+
+.form-control-dark:focus {
+  border-color: transparent;
+  box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
+}