mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-09-12 11:10:59 +02:00
refactor(starter): upgrade and move to typescript
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
@import "../../../assets/scss/mixins";
|
||||
|
||||
.meta {
|
||||
&__date {
|
||||
.date {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
@@ -2,10 +2,13 @@ import React from "react";
|
||||
import renderer from "react-test-renderer";
|
||||
|
||||
import { Meta } from "@/components/Post/Meta";
|
||||
import * as mocks from "@/mocks";
|
||||
|
||||
describe("Meta", () => {
|
||||
it("renders correctly", () => {
|
||||
const props = { date: "2016-09-01" };
|
||||
const props = {
|
||||
date: mocks.markdownRemark.frontmatter.date,
|
||||
};
|
||||
|
||||
const tree = renderer.create(<Meta {...props} />).toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
|
||||
import styles from "./Meta.module.scss";
|
||||
import * as styles from "./Meta.module.scss";
|
||||
|
||||
interface Props {
|
||||
date: string;
|
||||
@@ -8,7 +8,7 @@ interface Props {
|
||||
|
||||
const Meta: React.FC<Props> = ({ date }: Props) => (
|
||||
<div className={styles.meta}>
|
||||
<p className={styles.meta__date}>
|
||||
<p className={styles.date}>
|
||||
Published{" "}
|
||||
{new Date(date).toLocaleDateString("en-US", {
|
||||
year: "numeric",
|
||||
|
@@ -1,12 +1,8 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Meta renders correctly 1`] = `
|
||||
<div
|
||||
className="meta"
|
||||
>
|
||||
<p
|
||||
className="meta__date"
|
||||
>
|
||||
<div>
|
||||
<p>
|
||||
Published
|
||||
|
||||
Sep 1, 2016
|
||||
|
Reference in New Issue
Block a user