Simplify function to geenrate icon svg xml
This commit is contained in:
parent
3da11bf255
commit
a4f5e4d63e
1 changed files with 12 additions and 11 deletions
23
src/bi.lisp
23
src/bi.lisp
|
@ -7,15 +7,16 @@
|
|||
(defparameter bi-icons
|
||||
'((0-circle . "<path d='M7.988 12.158c-1.851 0-2.941-1.57-2.941-3.99V7.84c0-2.408 1.101-3.996 2.965-3.996 1.857 0 2.935 1.57 2.935 3.996v.328c0 2.408-1.101 3.99-2.959 3.99M8 4.951c-1.008 0-1.629 1.09-1.629 2.895v.31c0 1.81.627 2.895 1.629 2.895s1.623-1.09 1.623-2.895v-.31c0-1.8-.621-2.895-1.623-2.895'/><path d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8'/>")
|
||||
(0-circle-fill . "<path d='M8 4.951c-1.008 0-1.629 1.09-1.629 2.895v.31c0 1.81.627 2.895 1.629 2.895s1.623-1.09 1.623-2.895v-.31c0-1.8-.621-2.895-1.623-2.895'/><path d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-8.012 4.158c1.858 0 2.96-1.582 2.96-3.99V7.84c0-2.426-1.079-3.996-2.936-3.996-1.864 0-2.965 1.588-2.965 3.996v.328c0 2.42 1.09 3.99 2.941 3.99'/>")
|
||||
(0-square . "<path d='M7.988 12.158c-1.851 0-2.941-1.57-2.941-3.99V7.84c0-2.408 1.101-3.996 2.965-3.996 1.857 0 2.935 1.57 2.935 3.996v.328c0 2.408-1.101 3.99-2.959 3.99M8 4.951c-1.008 0-1.629 1.09-1.629 2.895v.31c0 1.81.627 2.895 1.629 2.895s1.623-1.09 1.623-2.895v-.31c0-1.8-.621-2.895-1.623-2.895'/><path d='M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 0a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z'/>")))
|
||||
(0-square . "<path d='M7.988 12.158c-1.851 0-2.941-1.57-2.941-3.99V7.84c0-2.408 1.101-3.996 2.965-3.996 1.857 0 2.935 1.57 2.935 3.996v.328c0 2.408-1.101 3.99-2.959 3.99M8 4.951c-1.008 0-1.629 1.09-1.629 2.895v.31c0 1.81.627 2.895 1.629 2.895s1.623-1.09 1.623-2.895v-.31c0-1.8-.621-2.895-1.623-2.895'/><path d='M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 0a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z'/>")
|
||||
(0-square-fill . "<path d='M8 4.951c-1.008 0-1.629 1.09-1.629 2.895v.31c0 1.81.627 2.895 1.629 2.895s1.623-1.09 1.623-2.895v-.31c0-1.8-.621-2.895-1.623-2.895'/><path d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm5.988 12.158c-1.851 0-2.941-1.57-2.941-3.99V7.84c0-2.408 1.101-3.996 2.965-3.996 1.857 0 2.935 1.57 2.935 3.996v.328c0 2.408-1.101 3.99-2.959 3.99'/>")))
|
||||
|
||||
(defun bi-icon (identifier)
|
||||
(let ((icon-xml (rest (assoc identifier bi-icons)))
|
||||
(class (concatenate 'string "bi bi-" (string-downcase identifier))))
|
||||
(concatenate 'string
|
||||
"<svg xmlns='http://www.w3.org/2000/svg' width=16 height=16 fill=currentColor "
|
||||
"class="
|
||||
class
|
||||
" viewBox='0 0 16 16'>"
|
||||
icon-xml
|
||||
"</svg>")))
|
||||
(defun bi-build-icon (identifier &optional (dimension 16))
|
||||
(format nil
|
||||
"<svg xmlns='http://www.w3.org/2000/svg' width=~d height=~d fill='currentColor' class='bi
|
||||
bi-~A' viewBox='0 0 ~d ~d'>~A</svg>"
|
||||
dimension
|
||||
dimension
|
||||
(string-downcase identifier)
|
||||
dimension
|
||||
dimension
|
||||
(rest (assoc identifier bi-icons))))
|
||||
|
|
Loading…
Add table
Reference in a new issue