mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-09-11 12:05:35 +03:00
Default spacer to 10 width
This commit is contained in:
parent
4bb0b9d43e
commit
7e62f72da4
@ -20,7 +20,6 @@ buildUI
|
||||
-> TodoModel
|
||||
-> WidgetNode TodoModel TodoEvt
|
||||
buildUI wenv model = widgetTree where
|
||||
todoSpacer = spacer_ [width 10]
|
||||
todoView idx t = slideWidget `key` todoKey where
|
||||
todoKey = todoRowKey t
|
||||
todoDone = t ^. status == Done
|
||||
@ -41,40 +40,40 @@ buildUI wenv model = widgetTree where
|
||||
],
|
||||
filler,
|
||||
box_ [alignRight] todoStatus `style` [width 100],
|
||||
todoSpacer,
|
||||
spacer,
|
||||
rowButton "Edit" (TodoEdit idx t),
|
||||
todoSpacer,
|
||||
spacer,
|
||||
rowButton "Delete" (TodoDeleteBegin idx t)
|
||||
] `style` [paddingT 10 | idx > 0]
|
||||
slideWidget = fadeOut_ [onFinished (TodoDelete idx t)] todoRow
|
||||
todoEdit = vstack [
|
||||
hstack [
|
||||
label "Task:",
|
||||
todoSpacer,
|
||||
spacer,
|
||||
textField (activeTodo . description) `key` "todoDesc"
|
||||
],
|
||||
todoSpacer,
|
||||
spacer,
|
||||
hgrid [
|
||||
hstack [
|
||||
label "Type:",
|
||||
todoSpacer,
|
||||
spacer,
|
||||
textDropdownS (activeTodo . todoType) todoTypes `key` "todoType",
|
||||
todoSpacer -- Added here to avoid grid expanding it to 1/3 total width
|
||||
spacer -- Added here to avoid grid expanding it to 1/3 total width
|
||||
],
|
||||
hstack [
|
||||
label "Status:",
|
||||
todoSpacer,
|
||||
spacer,
|
||||
textDropdownS (activeTodo . status) todoStatuses
|
||||
]
|
||||
],
|
||||
todoSpacer,
|
||||
spacer,
|
||||
hstack [
|
||||
filler,
|
||||
case model ^. action of
|
||||
TodoAdding -> mainButton "Add" TodoAdd
|
||||
TodoEditing idx -> mainButton "Save" (TodoSave idx)
|
||||
_ -> spacer,
|
||||
todoSpacer,
|
||||
spacer,
|
||||
button "Cancel" TodoCancel
|
||||
]
|
||||
] `style` [bgColor editBgColor, padding 20]
|
||||
|
@ -45,14 +45,15 @@ buildUI wenv model = widgetTree where
|
||||
] `key` showt (item ^. ts) `style` [paddingT 5]
|
||||
widgetTree = vstack [
|
||||
keystroke [("Enter", AddItem)] $ hstack [
|
||||
label "Description: ",
|
||||
label "Description:",
|
||||
spacer,
|
||||
textField_ newItemText [placeholder "Write here!"] `key` "description",
|
||||
spacer,
|
||||
button "Add" AddItem `style` [paddingH 5]
|
||||
],
|
||||
separatorLine `style` [paddingT 10, paddingB 5],
|
||||
separatorLine `style` [paddingT 20, paddingB 15],
|
||||
vstack (zipWith listItem [0..] (model ^. items))
|
||||
] `style` [padding 10]
|
||||
] `style` [padding 20]
|
||||
|
||||
handleEvent
|
||||
:: WidgetEnv AppModel AppEvent
|
||||
|
@ -94,9 +94,11 @@ makeSpacer config = widget where
|
||||
|
||||
getSizeReq wenv node = sizeReq where
|
||||
direction = wenv ^. L.layoutDirection
|
||||
width = fromMaybe 5 (_spcWidth config)
|
||||
factor = fromMaybe 0.5 (_spcFactor config)
|
||||
isFixed = factor < 0.01
|
||||
width
|
||||
| isFixed = fromMaybe 10 (_spcWidth config)
|
||||
| otherwise = fromMaybe 5 (_spcWidth config)
|
||||
flexSide = flexSize 5 0.5
|
||||
fixedW = fixedSize width
|
||||
flexW = flexSize width factor
|
||||
|
@ -110,8 +110,8 @@ handleEventValue = describe "handleEventValue" $ do
|
||||
|
||||
getSizeReq :: Spec
|
||||
getSizeReq = describe "getSizeReq" $ do
|
||||
it "should return width = Fixed 65" $
|
||||
sizeReqW `shouldBe` fixedSize 65
|
||||
it "should return width = Fixed 70" $
|
||||
sizeReqW `shouldBe` fixedSize 70
|
||||
|
||||
it "should return height = Fixed 20" $
|
||||
sizeReqH `shouldBe` fixedSize 20
|
||||
|
@ -117,8 +117,8 @@ handleEventValue = describe "handleEventValue" $ do
|
||||
|
||||
getSizeReq :: Spec
|
||||
getSizeReq = describe "getSizeReq" $ do
|
||||
it "should return width = Fixed 65" $
|
||||
sizeReqW `shouldBe` fixedSize 65
|
||||
it "should return width = Fixed 70" $
|
||||
sizeReqW `shouldBe` fixedSize 70
|
||||
|
||||
it "should return height = Fixed 20" $
|
||||
sizeReqH `shouldBe` fixedSize 20
|
||||
|
@ -39,9 +39,9 @@ spacerSpec = describe "Spacer" $ do
|
||||
|
||||
spacerSizeReqBox :: Spec
|
||||
spacerSizeReqBox = describe "spacerSizeReqBox" $ do
|
||||
it "should return (Fixed 5, Fixed 5)" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 5
|
||||
sizeReqH1 `shouldBe` fixedSize 5
|
||||
it "should return (Fixed 10, Fixed 10)" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 10
|
||||
sizeReqH1 `shouldBe` fixedSize 10
|
||||
|
||||
where
|
||||
wenv = mockWenvEvtUnit ()
|
||||
@ -49,13 +49,13 @@ spacerSizeReqBox = describe "spacerSizeReqBox" $ do
|
||||
|
||||
spacerSizeReqGrid :: Spec
|
||||
spacerSizeReqGrid = describe "spacerSizeReqGrid" $ do
|
||||
it "should return (Fixed 5, Flex 5 0.5) for horizontal" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 5
|
||||
it "should return (Fixed 10, Flex 5 0.5) for horizontal" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 10
|
||||
sizeReqH1 `shouldBe` flexSize 5 0.5
|
||||
|
||||
it "should return (Flex 5 0.5, Fixed 5) for vertical" $ do
|
||||
it "should return (Flex 5 0.5, Fixed 10) for vertical" $ do
|
||||
sizeReqW2 `shouldBe` flexSize 5 0.5
|
||||
sizeReqH2 `shouldBe` fixedSize 5
|
||||
sizeReqH2 `shouldBe` fixedSize 10
|
||||
|
||||
where
|
||||
wenv = mockWenvEvtUnit ()
|
||||
@ -64,13 +64,13 @@ spacerSizeReqGrid = describe "spacerSizeReqGrid" $ do
|
||||
|
||||
spacerSizeReqStack :: Spec
|
||||
spacerSizeReqStack = describe "spacerSizeReqStack" $ do
|
||||
it "should return (Fixed 5, Flex 5 0.5) for horizontal" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 5
|
||||
it "should return (Fixed 10, Flex 5 0.5) for horizontal" $ do
|
||||
sizeReqW1 `shouldBe` fixedSize 10
|
||||
sizeReqH1 `shouldBe` flexSize 5 0.5
|
||||
|
||||
it "should return (Flex 5 0.5, Fixed 5) for vertical" $ do
|
||||
it "should return (Flex 10 0.5, Fixed 5) for vertical" $ do
|
||||
sizeReqW2 `shouldBe` flexSize 5 0.5
|
||||
sizeReqH2 `shouldBe` fixedSize 5
|
||||
sizeReqH2 `shouldBe` fixedSize 10
|
||||
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
|
Loading…
Reference in New Issue
Block a user