img_modal_svg

This commit is contained in:
Gregor Kleen 2018-10-14 17:24:19 +02:00
parent 18b3fe0e5d
commit 5332e22c13
3 changed files with 14 additions and 9 deletions

View File

@ -75,7 +75,6 @@ import qualified Control.Monad.Catch as C
import System.FilePath
import Handler.Utils.Templates
import Handler.Utils.StudyFeatures
import Control.Lens
import Utils

View File

@ -4,12 +4,9 @@ module Handler.Utils.Templates where
import Data.Either (isLeft)
import Import.NoFoundation
import Import
lipsum :: WidgetT site IO ()
lipsum = $(widgetFile "widgets/lipsum")
modal :: WidgetT site IO () -> Either (Route site) (WidgetT site IO ()) -> WidgetT site IO ()
modal :: WidgetT UniWorX IO () -> Either (Route UniWorX) (WidgetT UniWorX IO ()) -> WidgetT UniWorX IO ()
modal modalTrigger modalContent = do
let modalDynamic = isLeft modalContent
modalId <- newIdent
@ -18,14 +15,16 @@ modal modalTrigger modalContent = do
case modalContent of
-- TODO: refactor this. preferably put svg in separte file somewhere in static?
Left route -> [whamlet|
$newline never
<div .modal__trigger>
<a href=@{route} ##{triggerId}>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="modal__trigger-icon" x="0px" y="0px" viewBox="0 0 690 490" xml:space="preserve"><rect x="534.6" y="405" width="99" height="39.6"/><rect x="415.8" y="405" width="99" height="39.6"/><path d="M673.2,127.8H118.8v356.4h554.4V127.8z M601.92,166.794l5.334-5.334l10.506,10.506l10.506-10.506l5.334,5.334L623.094,177.3 l10.506,10.506l-5.334,5.334l-10.506-10.51l-10.506,10.506l-5.334-5.33l10.506-10.506L601.92,166.794z M158.4,169.38h198v15.84h-198 V169.38z M657.36,468.36H134.64V226.8h522.72V468.36z"/><rect x="198" y="325.8" width="396" height="15.84"/><rect x="198" y="286.2" width="198" height="15.84"/>
<object type="image/svg+xml" data=@{StaticR img_modal_svg} class=modal__triger-icon>
<span .modal__trigger-label>^{modalTrigger}
|]
Right content -> [whamlet|
Right _ -> [whamlet|
$newline never
<div .modal__trigger>
<div ##{triggerId}>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="modal__trigger-icon" x="0px" y="0px" viewBox="0 0 690 490" xml:space="preserve"><rect x="534.6" y="405" width="99" height="39.6"/><rect x="415.8" y="405" width="99" height="39.6"/><path d="M673.2,127.8H118.8v356.4h554.4V127.8z M601.92,166.794l5.334-5.334l10.506,10.506l10.506-10.506l5.334,5.334L623.094,177.3 l10.506,10.506l-5.334,5.334l-10.506-10.51l-10.506,10.506l-5.334-5.33l10.506-10.506L601.92,166.794z M158.4,169.38h198v15.84h-198 V169.38z M657.36,468.36H134.64V226.8h522.72V468.36z"/><rect x="198" y="325.8" width="396" height="15.84"/><rect x="198" y="286.2" width="198" height="15.84"/>
<object type="image/svg+xml" data=@{StaticR img_modal_svg} class=modal__trigger-icon>
<span .modal__trigger-label>^{modalTrigger}
|]

7
static/img/modal.svg Normal file
View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 690 490" xml:space="preserve">
<rect x="534.6" y="405" width="99" height="39.6"/>
<rect x="415.8" y="405" width="99" height="39.6"/>
<path d="M673.2,127.8H118.8v356.4h554.4V127.8z M601.92,166.794l5.334-5.334l10.506,10.506l10.506-10.506l5.334,5.334L623.094,177.3 l10.506,10.506l-5.334,5.334l-10.506-10.51l-10.506,10.506l-5.334-5.33l10.506-10.506L601.92,166.794z M158.4,169.38h198v15.84h-198 V169.38z M657.36,468.36H134.64V226.8h522.72V468.36z"/>
<rect x="198" y="325.8" width="396" height="15.84"/>
<rect x="198" y="286.2" width="198" height="15.84"/>
</svg>

After

Width:  |  Height:  |  Size: 696 B