Skip to content

Commit

Permalink
[Feat] Visitor count with Hits service (#162)
Browse files Browse the repository at this point in the history
- #close #161

Co-authored-by: cloud <[email protected]>
  • Loading branch information
sanghunlee-711 and cloud authored Jan 31, 2024
1 parent e26eb35 commit 42f991d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/components/Hits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Hits {
constructor({ $target }) {
this.$target = $target;

this.render();
}

render() {
this.$target.innerHTML = /* html */ `
<div class="hits-wrapper">
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fwww.cloud-sanghun.com&count_bg=%23C9C9C9&title_bg=%23555555&icon=googlecloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
<div>
`;
}
}

export default Hits;
3 changes: 2 additions & 1 deletion src/components/Nav.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SHOW_ROUTE } from '../common/constants/route.js';
import BurgerNavPopup from './BurggerNavPopup.js';

import Modal from './Modal.js';

class Nav {
Expand Down Expand Up @@ -29,7 +30,7 @@ class Nav {

render = () => {
this.$wrapper.innerHTML = `
<h1>Sanghun(Cloud) Lee</h1>
<h1>Sanghun Lee</h1>
<ul class="nav_list">
${SHOW_ROUTE.map((el) => {
return `
Expand Down
1 change: 1 addition & 0 deletions src/pages/Home/constants/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const $ELEMENT = {
HOME_MAIN_CONTAINER: 'home-main-container',
LATEST_POST_CONTAINER: 'latest-post-container',
RESUME_CONTAINERL: 'resume-container',
HITS_CONTAINER: 'hits-wrapper',
};
4 changes: 4 additions & 0 deletions src/pages/Home/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Contribution from './components/Contribution/index.js';
import LatestPost from './components/LatestPost/index.js';
import Hits from '../../components/Hits.js';
import { $ELEMENT } from './constants/element.js';

class Home {
Expand All @@ -17,6 +18,7 @@ class Home {
<div>
<section class="${$ELEMENT.LATEST_POST_CONTAINER}"></section>
<section class="${$ELEMENT.RESUME_CONTAINERL}"></section>
<div class=${$ELEMENT.HITS_CONTAINER}></div>
</div>
`;
};
Expand All @@ -30,11 +32,13 @@ class Home {
const resumeContainer = document.querySelector(
`.${$ELEMENT.RESUME_CONTAINERL}`
);
const hitsContainer = document.querySelector(`.${$ELEMENT.HITS_CONTAINER}`);

new LatestPost({
$target: postContainer,
});
new Contribution({ $target: resumeContainer });
new Hits({ $target: hitsContainer });
};

addListeners = () => {};
Expand Down
4 changes: 4 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,7 @@ body {
align-items: center;
justify-content: center;
}

.hits-wrapper {
margin: 36px 0px;
}

0 comments on commit 42f991d

Please sign in to comment.