Skip to content

Commit

Permalink
feat(admin-ui): added custom tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Jul 15, 2022
1 parent d283b04 commit 07eb695
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion admin-ui/app/routes/Dashboards/Chart/DashboardChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'recharts'
import './styles.css'
import { useSelector } from 'react-redux'
import TooltipDesign from './TooltipDesign'
import moment from 'moment'

const DashboardChart = () => {
Expand Down Expand Up @@ -58,7 +59,7 @@ const DashboardChart = () => {
<XAxis dataKey={'month'} />
<YAxis />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Tooltip content={<TooltipDesign />} />
<Legend wrapperStyle={{ color: '#fff' }} />
<Bar dataKey="client_credentials_access_token_count" fill={'#FE9F01'} />
<Bar dataKey="authz_code_access_token_count" fill={'#9CBEE0'} />
Expand Down
24 changes: 24 additions & 0 deletions admin-ui/app/routes/Dashboards/Chart/TooltipDesign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'

function TooltipDesign({ payload }) {
let objValues = {
client_credentials_access_token_count:
'Client credentials access token count',
authz_code_access_token_count: 'Authz code access token count',
authz_code_idtoken_count: 'Authz code idtoken count',
}
return (
<div className="bg-white thumbnail p-2">
{payload.length &&
payload.map((item, key) => {
return (
<div key={key} style={{ fontSize: '12px' }}>
{objValues[item.dataKey]} : {item.payload[item.dataKey]}
</div>
)
})}
</div>
)
}

export default TooltipDesign

0 comments on commit 07eb695

Please sign in to comment.