-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
286 additions
and
100 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,71 @@ | ||
// import dependencies | ||
import { observer } from 'mobx-react-lite'; | ||
|
||
// import local files | ||
import useDropdown from '../../../../hooks/useDropdown'; | ||
import Dropdown from '../../../ui/dropdown'; | ||
import useLocalStorageContext from '../../../../hooks/useLocalstorage'; | ||
import { FaBars, IoGrid } from '../../../icons'; | ||
|
||
const views = [ | ||
{ | ||
text: 'Cards', | ||
id: 'cards', | ||
icon: <IoGrid style={{ width: '20px', height: '20px' }} />, | ||
}, | ||
{ | ||
text: 'Compact', | ||
id: 'compact', | ||
icon: <FaBars style={{ width: '20px', height: '20px' }} />, | ||
}, | ||
]; | ||
|
||
const HomeMobileMenuLayout = () => { | ||
const { toggleDropdown, dropdownIsOpen } = useDropdown(true); | ||
|
||
const { layout, setLayout } = useLocalStorageContext(); | ||
|
||
const dropdownItems = views.map((view) => ( | ||
<Dropdown.Item | ||
key={view.id} | ||
onClick={() => { | ||
setLayout(view.id); | ||
toggleDropdown(); | ||
}} | ||
showDot | ||
isSelected={layout === view.id} | ||
dotColor="primary" | ||
> | ||
<div className="layout-option"> | ||
{view.icon} | ||
{view.text} | ||
</div> | ||
</Dropdown.Item> | ||
)); | ||
|
||
return ( | ||
<Dropdown.Container | ||
position="center" | ||
isOpen={dropdownIsOpen} | ||
toggleDropdown={toggleDropdown} | ||
id="home-menu-layout" | ||
> | ||
<Dropdown.Trigger | ||
isOpen={dropdownIsOpen} | ||
toggleDropdown={toggleDropdown} | ||
asInput | ||
> | ||
{layout.charAt(0).toUpperCase() + layout.slice(1)} | ||
</Dropdown.Trigger> | ||
<Dropdown.List isOpen={dropdownIsOpen} fullWidth> | ||
{dropdownItems} | ||
</Dropdown.List> | ||
</Dropdown.Container> | ||
); | ||
}; | ||
|
||
HomeMobileMenuLayout.displayName = 'HomeMobileMenuLayout'; | ||
|
||
HomeMobileMenuLayout.propTypes = {}; | ||
|
||
export default observer(HomeMobileMenuLayout); |
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,73 @@ | ||
// import local files | ||
import useDropdown from '../../../../hooks/useDropdown'; | ||
import Dropdown from '../../../ui/dropdown'; | ||
import useLocalStorageContext from '../../../../hooks/useLocalstorage'; | ||
|
||
import { HiStatusOffline, HiStatusOnline, FaBars } from '../../../icons'; | ||
|
||
const statusOptions = [ | ||
{ | ||
text: 'All', | ||
id: 'all', | ||
icon: <FaBars style={{ width: '20px', height: '20px' }} />, | ||
}, | ||
{ | ||
text: 'Up', | ||
id: 'up', | ||
icon: <HiStatusOnline style={{ width: '20px', height: '20px' }} />, | ||
}, | ||
{ | ||
text: 'Down', | ||
id: 'down', | ||
icon: <HiStatusOffline style={{ width: '20px', height: '20px' }} />, | ||
}, | ||
]; | ||
|
||
const HomeMobileMenuStatus = () => { | ||
const { toggleDropdown, dropdownIsOpen } = useDropdown(true); | ||
|
||
const { status, setStatus } = useLocalStorageContext(); | ||
|
||
const dropdownItems = statusOptions.map((view) => ( | ||
<Dropdown.Item | ||
key={view.id} | ||
onClick={() => { | ||
setStatus(view.id); | ||
toggleDropdown(); | ||
}} | ||
showDot | ||
isSelected={status === view.id} | ||
> | ||
<div className="layout-option"> | ||
{view.icon} | ||
{view.text} | ||
</div> | ||
</Dropdown.Item> | ||
)); | ||
|
||
return ( | ||
<Dropdown.Container | ||
position="center" | ||
isOpen={dropdownIsOpen} | ||
toggleDropdown={toggleDropdown} | ||
id="home-menu-status" | ||
> | ||
<Dropdown.Trigger | ||
isOpen={dropdownIsOpen} | ||
toggleDropdown={toggleDropdown} | ||
asInput | ||
> | ||
{status.charAt(0).toUpperCase() + status.slice(1)} | ||
</Dropdown.Trigger> | ||
<Dropdown.List isOpen={dropdownIsOpen} fullWidth> | ||
{dropdownItems} | ||
</Dropdown.List> | ||
</Dropdown.Container> | ||
); | ||
}; | ||
|
||
HomeMobileMenuStatus.displayName = 'HomeMobileMenuStatus'; | ||
|
||
HomeMobileMenuStatus.propTypes = {}; | ||
|
||
export default HomeMobileMenuStatus; |
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,54 @@ | ||
import './styles.scss'; | ||
|
||
// import dependencies | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import Monitor from '../../../../../pages/monitor'; | ||
|
||
const MonitorCompact = ({ children, monitor_id }) => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'grid', | ||
gridTemplateColumns: '400px 1fr', | ||
backgroundColor: 'var(--accent-800)', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
<div | ||
className="home-monitor-table" | ||
style={{ | ||
backgroundColor: 'var(--accent-900)', | ||
justifyContent: 'flex-start', | ||
borderRadius: 'var(--radius-md)', | ||
}} | ||
> | ||
<div className="home-monitor-table-container-compact"> | ||
<div className="home-monitor-table-header">Name</div> | ||
<div className="home-monitor-table-header">Uptime</div> | ||
</div> | ||
|
||
<div className="home-monitor-table-content">{children}</div> | ||
</div> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
overflow: 'auto', | ||
overflowX: 'hidden', | ||
borderRadius: 'var(--radius-md)', | ||
}} | ||
> | ||
<Monitor monitor_id="b65d48bd-64df-4c11-9a53-315ced89e974" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
MonitorCompact.displayName = 'MonitorCompact'; | ||
MonitorCompact.propTypes = { | ||
children: PropTypes.node, | ||
monitor_id: PropTypes.string, | ||
}; | ||
|
||
export default MonitorCompact; |
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
2 changes: 1 addition & 1 deletion
2
...mponents/home/monitor/layout/compact.scss → ...s/home/monitor/layout/compact/styles.scss
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.