Update accordion to the newest api

This commit is contained in:
Marcus Kammer 2024-02-04 18:34:43 +01:00
parent db5b87aac1
commit 1532c329f8
2 changed files with 60 additions and 3 deletions

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang=en data-bs-theme=dark>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<title>Accordion Example</title>
<link rel=stylesheet type=text/css
href=https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css>
</head>
<body>
<h1 class=visually-hidden>Accordion Example</h1>
<main class=container>
<div class=accordion id=accordionExample>
<div class=accordion-item>
<h2 class=accordion-header>
<button class=accordion-button type=button data-bs-toggle=collapse
data-bs-target=#collapse-accordionExample-1
aria-expanded=true aria-controls=collapse-accordionExample-1>Accordion Item #1</button>
</h2>
<div class="accordion-collapse collapse show"
id=collapse-accordionExample-1
data-bs-parent=#accordionExample>
<div class=accordion-body>
This is the first item&#39;s accordion body. It is shown by default, until the collapse plugin adds the appropriate
classes that we use to style each element. These classes control the overall appearance, as well as the showing and
hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It&#39;s
also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
</div>
</div>
</div>
<div class=accordion-item>
<h2 class=accordion-header>
<button class="accordion-button collapsed" type=button
data-bs-toggle=collapse
data-bs-target=#collapse-accordionExample-2
aria-expanded=false aria-controls=collapse-accordionExample-2>Accordion Item #2</button>
</h2>
<div class="accordion-collapse collapse"
id=collapse-accordionExample-2
data-bs-parent=#accordionExample>
<div class=accordion-body>
This is the second item&#39;s accordion body. It is hidden by default, until the collapse plugin adds the appropriate
classes that we use to style each element. These classes control the overall appearance, as well as the showing and
hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It&#39;s
also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
</div>
</div>
</div>
</div>
</main>
<script
src=https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js></script>
</body>
</html>

View file

@ -1,7 +1,7 @@
#+title: Using cl-sbt/accordion Macros in a Web Application #+title: Using cl-sbt/accordion Macros in a Web Application
#+author: Marcus Kammer #+author: Marcus Kammer
#+email: marcus.kammer@mailbox.org #+email: marcus.kammer@mailbox.org
#+date: 2024-02-04T13:09+01:00 #+date: 2024-02-04T18:34+01:00
* Introduction * Introduction
The accordion component is a popular UI element that helps to organize and The accordion component is a popular UI element that helps to organize and
@ -56,12 +56,15 @@ can integrate them into your project:
(with-output-to-string (spinneret:*html*) (with-output-to-string (spinneret:*html*)
(with-page (:title "Accordion Example" :main-con t) (with-page (:title "Accordion Example" :main-con t)
(accordion () (accordion ()
("Accordion Item #1" "This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.") "Accordion Item #1" "This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow."
("Accordion Item #2" "This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow."))))) "Accordion Item #2" "This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow."))))
(format t (generate-accordion-page)) (format t (generate-accordion-page))
#+end_src #+end_src
#+RESULTS: accordion-page
[[file:accordion-page.html]]
This example demonstrates how to integrate the cl-sbt/accordion macros into a This example demonstrates how to integrate the cl-sbt/accordion macros into a
web application to create an interactive accordion component. The macros help web application to create an interactive accordion component. The macros help
generate the necessary HTML structure for the accordion, which allows users to generate the necessary HTML structure for the accordion, which allows users to