mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-10-31 16:49:49 +01:00 
			
		
		
		
	refactor(starter): upgrade to new version of gatsby
This commit is contained in:
		| @@ -1,15 +0,0 @@ | ||||
| // @flow strict | ||||
| import React from 'react'; | ||||
| import styles from './Meta.module.scss'; | ||||
|  | ||||
| type Props = { | ||||
|   date: string | ||||
| }; | ||||
|  | ||||
| const Meta = ({ date }: Props) => ( | ||||
|   <div className={styles['meta']}> | ||||
|     <p className={styles['meta__date']}>Published {new Date(date).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })}</p> | ||||
|   </div> | ||||
| ); | ||||
|  | ||||
| export default Meta; | ||||
| @@ -1,9 +1,8 @@ | ||||
| @import '../../../assets/scss/variables'; | ||||
| @import '../../../assets/scss/mixins'; | ||||
| @import "../../../assets/scss/variables"; | ||||
| @import "../../../assets/scss/mixins"; | ||||
|  | ||||
| .meta { | ||||
|   &__date { | ||||
|     font-style: italic; | ||||
|   } | ||||
|  | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -1,15 +0,0 @@ | ||||
| // @flow strict | ||||
| import React from 'react'; | ||||
| import renderer from 'react-test-renderer'; | ||||
| import Meta from './Meta'; | ||||
|  | ||||
| describe('Meta', () => { | ||||
|   it('renders correctly', () => { | ||||
|     const props = { | ||||
|       date: '2016-09-01' | ||||
|     }; | ||||
|  | ||||
|     const tree = renderer.create(<Meta {...props} />).toJSON(); | ||||
|     expect(tree).toMatchSnapshot(); | ||||
|   }); | ||||
| }); | ||||
							
								
								
									
										13
									
								
								src/components/Post/Meta/Meta.test.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/components/Post/Meta/Meta.test.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| import React from "react"; | ||||
| import renderer from "react-test-renderer"; | ||||
|  | ||||
| import { Meta } from "@/components/Post/Meta"; | ||||
|  | ||||
| describe("Meta", () => { | ||||
|   it("renders correctly", () => { | ||||
|     const props = { date: "2016-09-01" }; | ||||
|  | ||||
|     const tree = renderer.create(<Meta {...props} />).toJSON(); | ||||
|     expect(tree).toMatchSnapshot(); | ||||
|   }); | ||||
| }); | ||||
							
								
								
									
										22
									
								
								src/components/Post/Meta/Meta.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/components/Post/Meta/Meta.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| import React from "react"; | ||||
|  | ||||
| import styles from "./Meta.module.scss"; | ||||
|  | ||||
| interface Props { | ||||
|   date: string; | ||||
| } | ||||
|  | ||||
| const Meta: React.FC<Props> = ({ date }: Props) => ( | ||||
|   <div className={styles.meta}> | ||||
|     <p className={styles.meta__date}> | ||||
|       Published{" "} | ||||
|       {new Date(date).toLocaleDateString("en-US", { | ||||
|         year: "numeric", | ||||
|         month: "short", | ||||
|         day: "numeric", | ||||
|       })} | ||||
|     </p> | ||||
|   </div> | ||||
| ); | ||||
|  | ||||
| export default Meta; | ||||
| @@ -7,7 +7,8 @@ exports[`Meta renders correctly 1`] = ` | ||||
|   <p | ||||
|     className="meta__date" | ||||
|   > | ||||
|     Published  | ||||
|     Published | ||||
|       | ||||
|     Sep 1, 2016 | ||||
|   </p> | ||||
| </div> | ||||
| @@ -1,2 +0,0 @@ | ||||
| // @flow strict | ||||
| export { default } from './Meta'; | ||||
							
								
								
									
										1
									
								
								src/components/Post/Meta/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/components/Post/Meta/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| export { default as Meta } from "./Meta"; | ||||
		Reference in New Issue
	
	Block a user