Skip to content

Commit e4d730e

Browse files
committed
Added health check component, axios, and status indicator
1 parent 2fae53b commit e4d730e

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

templates/react/src/components/health-check/index.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,6 @@
11
import React, { useState, useEffect } from 'react'
22
import axios from 'axios'
3-
import { withStyles } from '@material-ui/core/styles'
4-
import { red, green } from '@material-ui/core/colors'
5-
import Radio from '@material-ui/core/Radio'
6-
7-
const radioStyle = (customColor) => ({
8-
root: {
9-
color: customColor,
10-
'&$checked': {
11-
color: customColor,
12-
},
13-
},
14-
checked: {},
15-
})
16-
17-
const CustomRadio = (customColor) => (
18-
withStyles(radioStyle(customColor))(props => <Radio checked={true} color="default" {...props} />)
19-
)
20-
21-
const GreenRadio = CustomRadio(green[600])
22-
const RedRadio = CustomRadio(red[600])
23-
24-
function StatusIcon(props) {
25-
return props.value === 200 ? <GreenRadio /> : <RedRadio />
26-
}
3+
import StatusIcon from './status-icon'
274

285
function HealthCheck() {
296
const [data, setData] = useState({ status: {} })
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import { withStyles } from '@material-ui/core/styles'
3+
import { red, green } from '@material-ui/core/colors'
4+
import Radio from '@material-ui/core/Radio'
5+
6+
const radioStyle = (customColor) => ({
7+
root: {
8+
color: customColor,
9+
'&$checked': {
10+
color: customColor,
11+
},
12+
},
13+
checked: {},
14+
})
15+
16+
const CustomRadio = (customColor) => (
17+
withStyles(radioStyle(customColor))(props => <Radio checked={true} color="default" {...props} />)
18+
)
19+
20+
const GreenRadio = CustomRadio(green[600])
21+
const RedRadio = CustomRadio(red[600])
22+
23+
function StatusIcon(props) {
24+
return props.value === 200 ? <GreenRadio /> : <RedRadio />
25+
}
26+
27+
export default StatusIcon

0 commit comments

Comments
 (0)