-
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.
Merge pull request #56 from KSJaay/v0.6.3
v0.6.3 - Adds new compact mode
- Loading branch information
Showing
27 changed files
with
319 additions
and
185 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import './styles.scss'; | ||
|
||
// import dependencies | ||
import PropTypes from 'prop-types'; | ||
import Monitor from '../../../../../pages/monitor'; | ||
|
||
const MonitorCompact = ({ children, monitor_id }) => { | ||
return ( | ||
<div className="home-monitor-compact"> | ||
<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> | ||
|
||
<div className="home-monitor-compact-table-content">{children}</div> | ||
</div> | ||
<div className="home-monitor-compact-content"> | ||
{monitor_id && <Monitor monitor_id={monitor_id} />} | ||
|
||
{!monitor_id && ( | ||
<div className="home-monitor-compact-content-empty"> | ||
Select a monitor | ||
</div> | ||
)} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// import dependencies | ||
import PropTypes from 'prop-types'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
// import local files | ||
import { monitorPropType } from '../../../../../../shared/utils/propTypes'; | ||
import classNames from 'classnames'; | ||
|
||
const MonitorCompactItem = ({ monitor = {}, isActive, setActive }) => { | ||
const navigate = useNavigate(); | ||
|
||
const { name, url } = monitor; | ||
|
||
const classes = classNames('home-monitor-name-compact', { | ||
'home-monitor-name-compact-active': isActive, | ||
}); | ||
|
||
return ( | ||
<div | ||
className="home-monitor-container-compact" | ||
onClick={() => { | ||
if (window.innerWidth <= 1024) { | ||
return navigate(`/monitor/${monitor.monitorId}`); | ||
} | ||
|
||
setActive(monitor.monitorId); | ||
}} | ||
id={`monitor-${monitor.name}`} | ||
> | ||
<div className={classes}> | ||
<div>{name}</div> | ||
<div style={{ fontSize: '0.85rem', color: 'var(--accent-200)' }}> | ||
{url} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
MonitorCompactItem.displayName = 'MonitorCompactItem'; | ||
|
||
MonitorCompactItem.propTypes = { | ||
monitor: monitorPropType.isRequired, | ||
isActive: PropTypes.bool, | ||
setActive: PropTypes.func, | ||
}; | ||
|
||
export default MonitorCompactItem; |
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,81 @@ | ||
@use '../../../../../styles/pxToRem.scss' as *; | ||
@use '../../../../../styles/breakpoints.scss' as *; | ||
|
||
.home-monitor-compact { | ||
display: grid; | ||
grid-template-columns: 350px 1fr; | ||
background-color: var(--accent-800); | ||
overflow: hidden; | ||
} | ||
|
||
.home-monitor-compact-content { | ||
display: flex; | ||
justify-content: center; | ||
overflow: auto; | ||
overflow-x: hidden; | ||
border-radius: var(--radius-md); | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.home-monitor-container-compact { | ||
width: 100%; | ||
background-color: var(--accent-900); | ||
padding: pxToRem(4) pxToRem(8); | ||
transition: var(--transition-base); | ||
|
||
&:hover { | ||
cursor: pointer; | ||
|
||
.home-monitor-name-compact { | ||
color: var(--primary-500); | ||
background-color: var(--accent-800); | ||
} | ||
} | ||
} | ||
|
||
.home-monitor-name-compact { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
color: var(--font-color); | ||
font-size: var(--font-lg); | ||
padding: pxToRem(4) pxToRem(8); | ||
border-radius: var(--radius-sm); | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
transition: var(--transition-base); | ||
|
||
&-active { | ||
color: var(--primary-500); | ||
background-color: var(--accent-800); | ||
} | ||
} | ||
|
||
.home-monitor-uptime-compact { | ||
flex: 1; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
color: var(--font-color); | ||
font-size: var(--font-lg); | ||
} | ||
|
||
.home-monitor-compact-content-empty { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
font-size: var(--font-2xl); | ||
color: var(--accent-200); | ||
} | ||
|
||
@include tablet { | ||
.home-monitor-compact { | ||
grid-template-columns: 1fr; | ||
} | ||
|
||
.home-monitor-compact-content { | ||
display: none; | ||
} | ||
} |
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.