Merge branch 'features/aboutme' into beta
- Add dynamic age in me.js - Add aboutme component
This commit is contained in:
Executable
+32
@@ -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;
|
||||||
|
}
|
||||||
Executable
+10
@@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user