diff --git a/messages/de.msg b/messages/de.msg index fec6874c8..b0d13a250 100644 --- a/messages/de.msg +++ b/messages/de.msg @@ -53,4 +53,5 @@ NotAParticipant user@Text tid@TermIdentifier csh@Text: #{user} ist nicht im Kurs HomeHeading: Startseite TermsHeading: Semesterübersicht -NumCourses n@Int64: #{tshow n} Kurse \ No newline at end of file +NumCourses n@Int64: #{tshow n} Kurse +CloseAlert: Schliessen diff --git a/src/Foundation.hs b/src/Foundation.hs index 4c0797575..2a968200c 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -481,6 +481,7 @@ instance Yesod UniWorX where $(widgetFile "standalone/showHide") $(widgetFile "standalone/inputs") $(widgetFile "standalone/tabber") + $(widgetFile "standalone/alerts") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") -- The page to be redirected to when authentication is required. diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index cd61199f4..39586cb46 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -22,7 +22,9 @@ $forall (status, msg) <- mmsgs $with status2 <- bool status "info" (status == "") -
#{msg} +
+
#{msg} +
_{MsgCloseAlert} diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index cf998ea71..a224040b5 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -1,8 +1,8 @@ :root { /* THEME INDEPENDENT COLORS */ - --color-error: red; - --color-warning: #fe7700; - --color-success: #2dcc35; + --color-error: #ff3860; + --color-warning: #ffdd57; + --color-success: #23d160; --color-info: #c4c4c4; --color-lightblack: #1A2A36; --color-lightwhite: #FCFFFA; @@ -264,7 +264,3 @@ a.btn.btn-info:hover, .btn.btn-info:hover { background-color: var(--color-grey) } - -.alert-debug { - background-color: rgb(240, 30, 240); -} diff --git a/templates/standalone/alerts.hamlet b/templates/standalone/alerts.hamlet new file mode 100644 index 000000000..163f415b4 --- /dev/null +++ b/templates/standalone/alerts.hamlet @@ -0,0 +1 @@ + diff --git a/templates/standalone/alerts.julius b/templates/standalone/alerts.julius new file mode 100644 index 000000000..253db2674 --- /dev/null +++ b/templates/standalone/alerts.julius @@ -0,0 +1,20 @@ +(function() { + 'use strict'; + + window.utils = window.utils || {}; + + window.utils.alert = function(alertEl) { + alertEl.querySelector('.alert__close').addEventListener('click', function(event) { + alertEl.classList.add('alert--invisible'); + }); + } + +})(); + +document.addEventListener('DOMContentLoaded', function() { + + // setup alerts + Array.from(document.querySelectorAll('.alert')).forEach(function(alertEl) { + window.utils.alert(alertEl); + }); +}); diff --git a/templates/standalone/alerts.lucius b/templates/standalone/alerts.lucius new file mode 100644 index 000000000..e5ddc7b1f --- /dev/null +++ b/templates/standalone/alerts.lucius @@ -0,0 +1,71 @@ +/* ALERTS */ +.alert { + position: relative; + display: flex; + justify-content: space-between; + background-color: #f5f5f5; + font-size: 1rem; + border-color: #dbdbdb; + border-radius: 4px; + border-style: solid; + border-width: 0 0 0 4px; + color: #4a4a4a; + z-index: 0; + max-height: 200px; + transition: all .2s ease-in-out; + transform-origin: top; +} + +.alert__content { + padding: 1.25em 1.5em; +} + +.alert__close { + cursor: pointer; + text-align: right; + display: flex; + align-items: center; + justify-content: center; + padding: 0 10px; + background-color: var(--color-light); + color: var(--color-lightwhite); + transition: all .2s ease; + + &:hover { + background-color: var(--color-primary); + transform: scale(1.05, 1.05); + } +} + +.alert-success { + background-color: #f6fef9; + border-color: var(--color-success); + + .alert__close { + background-color: var(--color-success); + } +} + +.alert-warning { + background-color: #fffdf5; + border-color: var(--color-warning); + + .alert__close { + background-color: var(--color-warning); + color: var(--color-dark); + } +} + +.alert-error { + border-color: var(--color-error); + background-color: #fff5f7; + + .alert__close { + background-color: var(--color-error); + } +} + +.alert--invisible { + max-height: 0; + transform: scaleY(0); +} diff --git a/templates/standalone/inputs.lucius b/templates/standalone/inputs.lucius index 6d442cffa..4729a1d47 100644 --- a/templates/standalone/inputs.lucius +++ b/templates/standalone/inputs.lucius @@ -76,7 +76,7 @@ input[type="email"] { } input, textarea { - border-bottom-color: var(--color-lighter); + border-bottom-color: var(--color-primary); } } @@ -112,6 +112,7 @@ input[type="email"]:focus { /* TEXTAREAS */ textarea { -webkit-appearance: none; + appearance: none; border: 1px solid transparent; border-radius: 2px; display: inline-flex; @@ -143,6 +144,7 @@ input[type="checkbox"] { height: 20px; width: 20px; -webkit-appearance: none; + appearance: none; cursor: pointer; } input[type="checkbox"]::before { diff --git a/templates/widgets/breadcrumbs.lucius b/templates/widgets/breadcrumbs.lucius index 5dc759413..c5ada3434 100644 --- a/templates/widgets/breadcrumbs.lucius +++ b/templates/widgets/breadcrumbs.lucius @@ -5,7 +5,7 @@ color: white; margin-left: -40px; margin-right: -40px; - margin-bottom: 10px; + margin-bottom: 20px; transition: margin-bottom .2s ease; }