2023-07-14 19:54:28 +02:00
|
|
|
#+author: Marcus Kammer
|
|
|
|
#+email: marcus.kammer@mailbox.org
|
|
|
|
#+options: toc:nil
|
|
|
|
|
2023-07-14 21:09:19 +02:00
|
|
|
* cl-sbt
|
2023-07-08 14:16:15 +02:00
|
|
|
|
2023-07-14 21:11:04 +02:00
|
|
|
** Introduction
|
|
|
|
|
2023-07-14 16:17:09 +02:00
|
|
|
A Common Lisp library for generating Bootstrap-based HTML markup. It provides
|
|
|
|
macros to easily create Bootstrap components such as accordions, alerts,
|
|
|
|
badges, buttons, cards, dropdowns, headers, list groups, navbars, nav-tabs,
|
|
|
|
pagination, and tables. This library is dependent on the Spinneret library for
|
|
|
|
HTML generation.
|
2023-06-29 17:19:12 +02:00
|
|
|
|
2023-07-14 19:59:01 +02:00
|
|
|
The following components are available as packages:
|
|
|
|
|
|
|
|
- accordion :: This package provides macros for generating Bootstrap Accordion
|
|
|
|
components. Accordions are collapsible lists of items, each of which can be
|
|
|
|
"expanded" or "collapsed" to reveal or hide content.
|
|
|
|
|
|
|
|
- alert :: This package offers macros for creating Bootstrap Alert components.
|
|
|
|
Alerts are used to provide user feedback, usually in response to user
|
|
|
|
interactions, such as form validation or actions.
|
|
|
|
|
|
|
|
- badge :: This package provides macros for creating Bootstrap Badge
|
|
|
|
components. Badges are small status descriptors for UI elements. They can be
|
|
|
|
used to add additional information to an element, such as a count.
|
|
|
|
|
|
|
|
- button :: This package provides macros for creating Bootstrap Button
|
|
|
|
components. Buttons are used for actions, like submitting forms or initiating
|
|
|
|
actions.
|
|
|
|
|
|
|
|
- card :: This package provides macros for creating Bootstrap Card components.
|
|
|
|
Cards are flexible and extensible containers for displaying content in a
|
|
|
|
structured format.
|
|
|
|
|
|
|
|
- dropdown :: This package provides macros for creating Bootstrap Dropdown
|
|
|
|
components. Dropdowns are toggleable, contextual overlays for displaying
|
|
|
|
lists of links and actions in a dropdown format.
|
|
|
|
|
|
|
|
- list group :: This package provides macros for generating Bootstrap List
|
|
|
|
Group components. List groups are flexible and powerful components for
|
|
|
|
displaying not only simple lists of elements, but complex ones with custom
|
|
|
|
content.
|
|
|
|
|
|
|
|
- navbar :: This package provides macros for creating Bootstrap Navbar
|
|
|
|
components. Navbars are responsive meta components that serve as navigation
|
|
|
|
headers for your application or site.
|
|
|
|
|
|
|
|
- nav / tab :: This package provides macros for creating Bootstrap Nav
|
|
|
|
components. Navs are navigation components that can be styled in different
|
|
|
|
ways and can contain links, text, or any other kind of content.
|
|
|
|
|
|
|
|
- pagination :: This package provides macros for creating Bootstrap Pagination
|
|
|
|
components. Pagination is used to let the user navigate through a set of
|
|
|
|
discrete pages.
|
|
|
|
|
|
|
|
- table :: This package provides macros for generating Bootstrap Table
|
|
|
|
components. Tables are used to present data in a tabular format.
|
|
|
|
|
|
|
|
- spinner :: This package provides macros for creating Bootstrap Spinner
|
|
|
|
components. Spinners are used to indicate a loading state of a page or a
|
|
|
|
section.
|
2023-07-14 19:54:28 +02:00
|
|
|
|
2023-06-29 17:19:12 +02:00
|
|
|
** Usage
|
|
|
|
|
2023-07-11 19:59:29 +02:00
|
|
|
*** Defining a Card
|
|
|
|
|
|
|
|
The following code demonstrates how to define a card using the card macro.
|
|
|
|
|
2023-08-26 08:40:31 +02:00
|
|
|
#+begin_src lisp :results output :exports both :eval no-export
|
2023-08-26 08:31:06 +02:00
|
|
|
(cl-sbt/card:card
|
|
|
|
(cl-sbt/card:body
|
|
|
|
(cl-sbt/card:title "Card title")
|
|
|
|
(cl-sbt/card:subtitle "Card subtitle")
|
|
|
|
(cl-sbt/card:text "Some quick example text to build on the card title and make up the bulk of the card's content.")
|
|
|
|
(cl-sbt/card:link (:href "#") "Card link")))
|
2023-07-11 19:59:29 +02:00
|
|
|
#+end_src
|
|
|
|
|
2023-08-26 08:36:03 +02:00
|
|
|
Results in:
|
|
|
|
|
2023-07-11 19:59:29 +02:00
|
|
|
#+RESULTS:
|
2023-08-26 08:40:31 +02:00
|
|
|
: <div class=card>
|
|
|
|
: <div class=card-body>
|
|
|
|
: <h5 class=card-title>Card title</h5>
|
|
|
|
: <h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6>
|
|
|
|
: <p class=card-text>Some quick example text to build on the card title and make up the bulk of the card's content.
|
|
|
|
: <a class=card-link href=#>Card link</a>
|
|
|
|
: </div>
|
|
|
|
: </div>
|
2023-07-11 21:08:20 +02:00
|
|
|
|
2023-07-11 21:10:11 +02:00
|
|
|
The following code demonstrates how to define a card using the card-with-img macro.
|
|
|
|
|
2023-08-26 08:40:31 +02:00
|
|
|
#+begin_src lisp :results output :exports both :eval no-export
|
2023-08-26 08:31:06 +02:00
|
|
|
(cl-sbt/card:card-with-img (:img-src "test.jpg")
|
|
|
|
(cl-sbt/card:title "Card title")
|
|
|
|
(cl-sbt/card:subtitle "Card subtitle")
|
|
|
|
(cl-sbt/card:text "Some quick example text to build on the card title and make up the bulk of the card's content.")
|
|
|
|
(cl-sbt/card:link (:href "#") "Card link"))
|
2023-07-11 21:08:20 +02:00
|
|
|
#+end_src
|
|
|
|
|
2023-08-26 08:36:03 +02:00
|
|
|
Results in:
|
|
|
|
|
2023-07-11 21:08:20 +02:00
|
|
|
#+RESULTS:
|
2023-08-26 08:40:31 +02:00
|
|
|
: <div class=card>
|
|
|
|
: <img class=card-img-top src=test.jpg alt="Card Image">
|
|
|
|
: <div class=card-body>
|
|
|
|
: <h5 class=card-title>Card title</h5>
|
|
|
|
: <h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6>
|
|
|
|
: <p class=card-text>Some quick example text to build on the card title and make up the bulk of the card's content.
|
|
|
|
: <a class=card-link href=#>Card link</a>
|
|
|
|
: </div>
|
|
|
|
: </div>
|
2023-07-11 19:59:29 +02:00
|
|
|
|
|
|
|
*** Defining a Dropdown
|
|
|
|
|
|
|
|
The following code demonstrates how to define a dropdown using the dropdown
|
|
|
|
macro.
|
|
|
|
|
2023-08-26 08:40:31 +02:00
|
|
|
#+begin_src lisp :results output :exports both :eval no-export
|
2023-08-26 08:31:06 +02:00
|
|
|
(cl-sbt/dropdown:dropdown (:name "Dropdown button")
|
|
|
|
(cl-sbt/dropdown:menu
|
|
|
|
(cl-sbt/dropdown:item "Action")
|
|
|
|
(cl-sbt/dropdown:item "Another action")
|
|
|
|
(cl-sbt/dropdown:item "Something else here")))
|
2023-07-11 19:59:29 +02:00
|
|
|
#+end_src
|
|
|
|
|
2023-08-26 08:36:03 +02:00
|
|
|
Results in:
|
|
|
|
|
2023-07-11 19:59:29 +02:00
|
|
|
#+RESULTS:
|
2023-08-26 08:40:31 +02:00
|
|
|
: <div class=dropdown>
|
|
|
|
: <button class="btn btn-secondary dropdown-toggle" type=button
|
|
|
|
: data-bs-toggle=dropdown aria-expanded=false>Dropdown button</button>
|
|
|
|
: <ul class=dropdown-menu>
|
|
|
|
: <li><a class=dropdown-item href=#>Action</a>
|
|
|
|
: <li><a class=dropdown-item href=#>Another action</a>
|
|
|
|
: <li><a class=dropdown-item href=#>Something else here</a>
|
|
|
|
: </ul>
|
|
|
|
: </div>
|
2023-07-11 19:59:29 +02:00
|
|
|
|
2023-08-26 08:45:28 +02:00
|
|
|
*** Defining a Questionnaire
|
|
|
|
|
|
|
|
The following code demonstrates how to define a questionnaire using the
|
|
|
|
questionnaire macro.
|
|
|
|
|
|
|
|
#+begin_src lisp :results output :export both :eval no-export
|
|
|
|
(cl-sbt/grid:con ()
|
|
|
|
(cl-sbt/questionnaire:questionnaire "/submit"
|
|
|
|
(:ask "How old are you?"
|
|
|
|
:group "age"
|
|
|
|
:choices (:single "18-24" "25-34" "35-44" "45-54" "55+"))
|
|
|
|
(:ask "Your Gender?"
|
|
|
|
:group "gender"
|
2023-08-26 08:47:48 +02:00
|
|
|
:choices (:single "Male" "Female" "Non-Binary" "Prefer not to say"))))
|
2023-08-26 08:45:28 +02:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Results in:
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
#+begin_example
|
|
|
|
<!-- START CONTAINER -->
|
|
|
|
<div class=container>
|
|
|
|
<form class=py-5 action=/submit method=get>
|
|
|
|
<fieldset>
|
|
|
|
<legend>How old are you?</legend>
|
|
|
|
<ol>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=age value=18-24> 18-24</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=age value=25-34> 25-34</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=age value=35-44> 35-44</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=age value=45-54> 45-54</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=age value=55+> 55+</label>
|
|
|
|
</ol>
|
|
|
|
<hr class=my-4>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
|
|
<legend>Your Gender?</legend>
|
|
|
|
<ol>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=gender value=Male> Male</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=gender value=Female> Female</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=gender value=Non-Binary> Non-Binary</label>
|
|
|
|
<li>
|
|
|
|
<label class=form-label>
|
|
|
|
<input type=radio name=gender value="Prefer not to say"> Prefer not to say</label>
|
|
|
|
</ol>
|
|
|
|
<hr class=my-4>
|
|
|
|
</fieldset>
|
|
|
|
<button class="btn btn-primary" type=submit>Submit</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<!-- END CONTAINER -->
|
|
|
|
#+end_example
|
|
|
|
|
2023-07-11 19:59:29 +02:00
|
|
|
** Installation
|
|
|
|
|
2023-07-08 14:16:15 +02:00
|
|
|
#+begin_src bash
|
|
|
|
git clone https://git.sr.ht/~marcuskammer/cl-sbt ~/quicklisp/local-projects/cl-sbt/
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+begin_src lisp
|
|
|
|
(ql:quickload :cl-sbt)
|
|
|
|
#+end_src
|
|
|
|
|
2023-09-06 17:07:39 +02:00
|
|
|
** Similar Libraries
|
|
|
|
- https://github.com/rmhsilva/semantic-spinneret
|
|
|
|
- https://github.com/thephoeron/cl-bootstrap
|
|
|
|
- https://github.com/rajasegar/cl-bootstrap/
|
2023-06-29 17:19:12 +02:00
|
|
|
** Author
|
|
|
|
|
2023-07-14 16:17:09 +02:00
|
|
|
- Marcus Kammer (marcus.kammer@mailbox.org)
|
2023-06-29 17:19:12 +02:00
|
|
|
|
|
|
|
** Copyright
|
|
|
|
|
|
|
|
Copyright (c) 2023 Marcus Kammer (marcus.kammer@mailbox.org)
|