Merge branch 'features/aboutme' into beta

- Add dynamic age in me.js
- Add aboutme component
master
Raymonzut 4 years ago
commit 97bb821f02
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 32
      src/components/aboutme.vue
  2. 21
      src/me.js
  3. 10
      test/me.js

@ -0,0 +1,32 @@
<template>
<div>
<h2>Who am I?</h2>
<p>
Hi there, good to see you on my website.
My name is Raymon Zutekouw({{ age }}).
Building software and exploring the wide variety of tools (or making them) is my passion.
To see it in action, checkout the stuff I make on <a href="https://github.com/Raymonzut">GitHub</a>.
The projects that may be useful to others are open source; for inspiring others and improving each others work.
That is why I am a huge fan of <a href="https://www.gnu.org/philosophy/free-sw.en.html">free software</a>.
</p>
</div>
</template>
<script>
import me from '../me.js'
export default {
name: 'aboutme',
computed: {
age: me.age
}
}
</script>
<style scoped>
p {
--margin-side: 12vw;
margin-left: var(--margin-side);
margin-right: var(--margin-side);
}
</style>

@ -0,0 +1,21 @@
module.exports = {
age: age,
};
function age() {
let birthdate = new Date(2002, 8, 29);
let now = new Date();
let age = now.getFullYear() - birthdate.getFullYear();
if (now.getMonth() < birthdate.getMonth()) {
age--;
}
if (
birthdate.getMonth() === now.getMonth() &&
now.getDate() < birthdate.getDate()
) {
age--;
}
return age;
}

@ -0,0 +1,10 @@
const assert = require("chai").assert;
const me = require("../src/me");
describe("me", () => {
describe("age", () => {
it("should return a positive number", () => {
assert.isAbove(me.age(), 0);
});
});
});
Loading…
Cancel
Save