Fix styling for button and dropdown

This commit is contained in:
Francisco Vallarino 2021-06-30 23:27:17 -03:00
parent 51362da960
commit 49bed0c564
4 changed files with 12 additions and 9 deletions

2
.ghcid
View File

@ -1,3 +1,3 @@
--command "stack repl --main-is monomer:exe:tutorial"
--command "stack repl --main-is monomer:exe:todo"
--test ":main"
--restart=package.yaml

View File

@ -29,13 +29,13 @@ buildUI wenv model = widgetTree where
todoStatus = labelS (t ^. status)
`style` [textSize 12, padding 4, paddingH 8, radius 12, bgColor todoBg, textColor todoFg]
rowButton caption action = button caption action
`style` [width 60, textColor gray, border 1 gray, bgColor transparent]
`style` [width 65, textColor gray, border 1 gray, bgColor transparent]
`hover` [bgColor editBgColor]
`focus` [border 1 lightSkyBlue]
todoRow = hstack [
vstack [
labelS (t ^. todoType) `style` [textSize 12, textColor darkGray],
spacer,
spacer_ [width 5],
label (t ^. description) `style` [textThroughline_ todoDone]
],
filler,

View File

@ -269,12 +269,12 @@ makeDropdown widgetData items makeMain makeRow config state = widget where
createDropdown wenv node newState = newNode where
selected = currentValue wenv
themeStyle = collectTheme wenv L.dropdownStyle
nodeStyle = _wnInfo node ^. L.style
mainStyle = def
& collectStyleField_ L.fgColor themeStyle
& collectStyleField_ L.hlColor themeStyle
& collectStyleField_ L.sndColor themeStyle
& collectStyleField_ L.text themeStyle
& collectStyleField_ L.fgColor nodeStyle
& collectStyleField_ L.hlColor nodeStyle
& collectStyleField_ L.sndColor nodeStyle
& collectStyleField_ L.text nodeStyle
mainNode = makeMain selected
& L.info . L.style .~ mainStyle
widgetId = node ^. L.info . L.widgetId

View File

@ -201,7 +201,8 @@ makeButton caption config = widget where
createChildNode wenv node = newNode where
nodeStyle = node ^. L.info . L.style
labelStyle = collectStyleField_ L.text nodeStyle def
labelStyle = def
& collectStyleField_ L.text nodeStyle
& collectStyleField_ L.sizeReqW nodeStyle
& collectStyleField_ L.sizeReqH nodeStyle
labelNode = label_ caption [ignoreTheme, _btnLabelCfg config]
@ -247,5 +248,7 @@ makeButton caption config = widget where
newReqH = child ^. L.info . L.sizeReqH
resize wenv node viewport children = resized where
style = getActiveStyle wenv node
carea = removeOuterBounds style viewport
assignedAreas = Seq.fromList [viewport]
resized = (resultNode node, assignedAreas)