-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add collapsibility to calculator pages (#1878)
* test: Try out one implementation of expandable * feat: Rudimentary implementation of collapsible * feat: Improve aesthetics * feat: Improve aesthetics * feat: Fix to bottom * feat: CollapsedPanel * fix: Improve styling * feat: Naïve implementation; will refactor * fix: Beginning of rewrite to use ThreeColumnPage for button * fix: Refactor CollapsedPanel * fix: Add panel titles as props * fix: Improve styling at bottom of page * feat: Add collapsing to household inputs * feat: Refactor using padding instead of margin * feat: Add proper sizing to middle panel of policy editor * feat: Replace box shadow with top border * fix: Redo how gradient ends are calced * fix: Change center title on policy output * fix: Repair household calculator panel names * fix: Fix household left panel sizing * fix: Improve sizing * chore: Lint * feat: Add width context to charts * feat: Refactor BottomCarousel to work with collapse * fix: Lint * fix: Move resize observer to ThreePanelPage * feat: Add resizing to input charts * fix: Polyfill ResizeObserver --------- Co-authored-by: PolicyEngine[bot] <hello@policyengine.org>
- Loading branch information
Showing
28 changed files
with
443 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { DoubleLeftOutlined, DoubleRightOutlined } from "@ant-design/icons"; | ||
import { Tooltip } from "antd"; | ||
import fixedStyles from "../style"; | ||
|
||
export default function CollapseButton(props) { | ||
const { onClick, isCollapsed, style, title } = props; | ||
|
||
function clickHandler() { | ||
if (onClick instanceof Function) { | ||
onClick(); | ||
} | ||
} | ||
|
||
return ( | ||
<div | ||
style={{ | ||
width: "100%", | ||
display: "flex", | ||
justifyContent: "flex-start", | ||
alignItems: "center", | ||
gap: "12px", | ||
// Extra padding at bottom to | ||
// avoid collision with scrollbar | ||
// padding: "10px 0px 0px 20px", | ||
paddingLeft: "20px", | ||
borderStyle: "solid", | ||
borderImage: `linear-gradient(to right, | ||
${fixedStyles.colors.LIGHT_GRAY} 0px, | ||
${fixedStyles.colors.LIGHT_GRAY} 12px, | ||
${fixedStyles.colors.MEDIUM_DARK_GRAY} 12px, | ||
${fixedStyles.colors.MEDIUM_DARK_GRAY} calc(100% - 12px), | ||
${fixedStyles.colors.LIGHT_GRAY} calc(100% - 12px), | ||
${fixedStyles.colors.LIGHT_GRAY} 100%) 100% 0 0 0/3px 0 0 0 stretch`, | ||
backgroundColor: fixedStyles.colors.LIGHT_GRAY, | ||
borderImageWidth: "1px", | ||
borderWidth: "1px", | ||
height: "100%", | ||
...style, | ||
}} | ||
> | ||
<Tooltip | ||
title={`${isCollapsed ? "Maximize" : "Minimize"} panel`} | ||
placement="right" | ||
> | ||
{isCollapsed ? ( | ||
<DoubleRightOutlined | ||
onClick={clickHandler} | ||
style={{ | ||
fontSize: "12px", | ||
color: fixedStyles.colors.DARK_GRAY, | ||
}} | ||
/> | ||
) : ( | ||
<DoubleLeftOutlined | ||
onClick={clickHandler} | ||
style={{ | ||
fontSize: "12px", | ||
color: fixedStyles.colors.DARK_GRAY, | ||
}} | ||
/> | ||
)} | ||
</Tooltip> | ||
<p | ||
style={{ | ||
margin: "0", | ||
fontSize: "12px", | ||
color: fixedStyles.colors.DARK_GRAY, | ||
}} | ||
> | ||
{title} | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import style from "../style"; | ||
|
||
export default function CollapsedPanel(props) { | ||
const { title } = props; | ||
|
||
return ( | ||
<div | ||
style={{ | ||
height: "100%", | ||
width: "100%", | ||
backgroundColor: style.colors.LIGHT_GRAY, | ||
position: "relative", | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
}} | ||
> | ||
<p | ||
style={{ | ||
writingMode: "sideways-lr", | ||
margin: "0", | ||
paddingTop: "30px", | ||
fontSize: "12px", | ||
color: style.colors.DARK_GRAY, | ||
}} | ||
> | ||
{title} | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.