Skip to content

Commit

Permalink
Feat: graph title and description (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
raipen authored Apr 1, 2023
1 parent 4eae4b7 commit 0e4322d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 10 deletions.
2 changes: 2 additions & 0 deletions summe/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
9 changes: 3 additions & 6 deletions summe/src/component/graph/Blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ export default function Blog({ state }) {
chart: {
height: 350,
type: "treemap",
},
title: {
text: "Basic Treemap",
},
},
}
}
});
} catch (error) {
console.error(error);
Expand All @@ -57,6 +54,6 @@ export default function Blog({ state }) {
}, []);

return (
<GraphWrapper data={data} type="treemap" height="350px" width="100%"/>
<GraphWrapper data={data} type="treemap" height="350px" width="100%" title="그래프 테스트" description="그래프 설명"/>
);
}
33 changes: 33 additions & 0 deletions summe/src/component/graph/GraphTitle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.description{
position: relative;
margin-left: 0.5rem;
}

.description>div{
display: none;
position: absolute;
top: calc(100% + 0.5rem);
left: 0;
width: max-content;
font-size: 1rem;
background-color: #B0BEC5;
padding: 0.5rem;
color: white;
z-index: 1;
}

.description>div::before{
content: "";
position: absolute;
top: -0.5rem;
left: 0.5rem;
width: 0;
height: 0;
border-left: 0.5rem solid transparent;
border-right: 0.5rem solid transparent;
border-bottom: 0.5rem solid #B0BEC5;
}

.description:hover>div{
display: inline-block;
}
17 changes: 16 additions & 1 deletion summe/src/component/graph/GraphWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ApexCharts from "react-apexcharts";
import "./GraphTitle.css";

const LoadingBox = () => {
return (
Expand All @@ -8,9 +9,23 @@ const LoadingBox = () => {
);
};

export default function GraphWrapper({ data, type, height, width }) {
const GraphTitle = ({ title, description }) => {
return (
<div style={{ display: "flex", alignItems: "center" }}>
<div style={{ fontSize: "1.5rem", fontWeight: "bold" }}>{title}</div>
<div className="material-icons description" style={{color: "gray" }}>
help_outline
<div>{description}</div>
</div>
</div>
);

};

export default function GraphWrapper({ data, type, height, width, title = "그래프 제목", description = "그래프 설명"}) {
return (
<div style={{width:width,height:height,display:"inline-block"}}>
<GraphTitle title={title} description={description}/>
{data
? <ApexCharts
options={data.options}
Expand Down
13 changes: 10 additions & 3 deletions summe/src/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap');

html,body{
margin: 0;
padding: 0;
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Expand Down

0 comments on commit 0e4322d

Please sign in to comment.