-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the status-monitor.svg-components namespace to contain a whole range of SVG elements that could be used for the dashboard. Initially just a demo image has been created. The demo image has been added to the status-monitor dashboard to show how well SVG components are rendered in a web page.
- Loading branch information
1 parent
a717816
commit 427c56c
Showing
2 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
(ns status-monitor.svg-components) | ||
|
||
;; Converting HTML SVG components into equivalent Clojure code | ||
;; Ideally create a library of components that can be easily used | ||
;; | ||
;; HTML SVG specification from Mozilla | ||
;; https://developer.mozilla.org/en-US/docs/Web/SVG/Element | ||
|
||
;; An alternative approach would be to write a parser that | ||
;; generated Clojure Hiccup style code from HTML SVG code. | ||
|
||
|
||
|
||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;; Demos | ||
|
||
|
||
|
||
;; Circle in a box | ||
(def circle-in-a-box | ||
[:svg {:version "1.1" | ||
:base-profile "full" | ||
:width 300 | ||
:height 200 | ||
:xmlns "http://www.w3.org/2000/svg"} | ||
|
||
[:rect {:width "100%" | ||
:height "100%" | ||
:fill "blue"}] | ||
[:circle {:cx 150 | ||
:cy 100 | ||
:r 80 | ||
:fill "green"}] | ||
[:text {:x 150 | ||
:y 125 | ||
:font-size 60 | ||
:text-anchor "middle" | ||
:fill "white"} | ||
"SVG"]]) | ||
|
||
;; <svg version="1.1" | ||
;; baseProfile="full" | ||
;; width="300" height="200" | ||
;; xmlns="http://www.w3.org/2000/svg"> | ||
|
||
;; <rect width="100%" height="100%" fill="red" /> | ||
;; <circle cx="150" cy="100" r="80" fill="green" /> | ||
;; <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">SVG</text> | ||
;; </svg> |