-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom reports: hide "show ..." checkboxes in menu (#2174)
* Add Toggles * budget table * testing * updates * updates * fixes * updates * fix Menu * lint fixes * fix keybindings * revert budget menu changes * notes * remove default exports * fixes * disabled fix * add style option * lint fix * remove css * lint fixes * color updates * merge menu with togglemenu * host * menu fixes * fix regression * remove host * adjustments * onToggle * vrt fix * typecheck * merge fixes * colors * lint fix
- Loading branch information
Showing
7 changed files
with
186 additions
and
80 deletions.
There are no files selected for viewing
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,75 @@ | ||
import React from 'react'; | ||
|
||
import { css } from 'glamor'; | ||
|
||
import { theme, type CSSProperties } from '../../style'; | ||
|
||
type ToggleProps = { | ||
id: string; | ||
checked: boolean; | ||
onToggle?: () => void; | ||
onColor?: string; | ||
style?: CSSProperties; | ||
}; | ||
|
||
export const Toggle = ({ | ||
id, | ||
checked, | ||
onToggle, | ||
onColor, | ||
style, | ||
}: ToggleProps) => { | ||
return ( | ||
<div style={{ marginTop: -20, ...style }}> | ||
<input | ||
id={id} | ||
checked={checked} | ||
onChange={onToggle} | ||
className={`${css({ | ||
height: 0, | ||
width: 0, | ||
visibility: 'hidden', | ||
})}`} | ||
type="checkbox" | ||
/> | ||
<label | ||
style={{ | ||
background: checked ? onColor : theme.checkboxToggleBackground, | ||
}} | ||
className={`${css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
cursor: 'pointer', | ||
width: '32px', | ||
height: '16px', | ||
borderRadius: '100px', | ||
position: 'relative', | ||
transition: 'background-color .2s', | ||
})}`} | ||
htmlFor={id} | ||
> | ||
<span | ||
className={`${css( | ||
{ | ||
content: '', | ||
position: 'absolute', | ||
top: '2px', | ||
left: '2px', | ||
width: '12px', | ||
height: '12px', | ||
borderRadius: '100px', | ||
transition: '0.2s', | ||
background: '#fff', | ||
boxShadow: '0 0 2px 0 rgba(10, 10, 10, 0.29)', | ||
}, | ||
checked && { | ||
left: 'calc(100% - 2px)', | ||
transform: 'translateX(-100%)', | ||
}, | ||
)}`} | ||
/> | ||
</label> | ||
</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
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,6 @@ | ||
--- | ||
category: Enhancements | ||
authors: [carkom] | ||
--- | ||
|
||
Hide "show ..." checkboxes within menu for custom reports page. Introduce toggle switches. |