From 712dcfbf9d21920f648c21549d37677acc1b1f4f Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Thu, 8 Apr 2021 13:41:02 +0200 Subject: [PATCH] chore: adjust icon size --- src/Handler/Course/Show.hs | 20 ++++++++------------ src/Utils/Icon.hs | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index 896ddf271..d21f04646 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -38,16 +38,12 @@ instance Finite CourseFavouriteToggleButton nullaryPathPiece ''CourseFavouriteToggleButton $ camelToPathPiece' 4 instance Button UniWorX CourseFavouriteToggleButton where - btnLabel BtnCourseFavouriteToggleManual = toWidget iconCourseFavouriteManual - btnLabel BtnCourseFavouriteToggleAutomatic = toWidget iconCourseFavouriteAutomatic - btnLabel BtnCourseFavouriteToggleOff = [whamlet| - $newline never - - - ^{iconCourseFavouriteManual} - - ^{iconCourseFavouriteOff} - |] + btnLabel BtnCourseFavouriteToggleManual + = toWidget $ icon2x IconCourseFavouriteManual + btnLabel BtnCourseFavouriteToggleAutomatic + = toWidget $ icon2x IconCourseFavouriteAutomatic + btnLabel BtnCourseFavouriteToggleOff + = toWidget $ iconStacked IconCourseFavouriteManual IconCourseFavouriteOff btnClasses _ = [BCIsButton, BCLink] @@ -324,7 +320,6 @@ getCShowR tid ssh csh = do mayCreateEvents <- hasWriteAccessTo $ CourseR tid ssh csh CEventsNewR mayEdit <- hasWriteAccessTo $ CourseR tid ssh csh CEditR - -- TODO use different style for button (neutral background?) let favouriteReason = case favouriteReason' of -- (reason, blacklist) (Just (_reason, True)) -> Nothing @@ -347,7 +342,8 @@ getCShowR tid ssh csh = do $if not courseVisible && mayEdit \ #{iconInvisible} $if isJust muid - ^{favouriteToggleWgt} + + ^{favouriteToggleWgt} |] siteLayout heading $ do diff --git a/src/Utils/Icon.hs b/src/Utils/Icon.hs index a8be79b11..a56b5cc17 100644 --- a/src/Utils/Icon.hs +++ b/src/Utils/Icon.hs @@ -195,6 +195,25 @@ icon ic = [shamlet| |] +-- Create an icon from font-awesome without additional space at 2x size +icon2x :: Icon -> Markup +icon2x ic + = [shamlet| + $newline never + + |] + +-- Stack two icons from font-awesome without additional space (both at 2x size) +-- stacked Icons are always double size, so they are correctly aligned with those produced by 'icon2x' +iconStacked :: Icon -> Icon -> Markup +iconStacked ic0 ic1 + = [shamlet| + $newline never + + + + |] + -- Create an icon (defaults to "?") with a specified tooltip iconTooltip :: forall site. WidgetFor site () -> Maybe Icon -> Bool -> WidgetFor site () iconTooltip tooltip mIcon isInlineTooltip = let