commit
b9f109b7fb
@ -1,10 +1,31 @@
|
|||||||
import {render} from '@testing-library/react';
|
import {render} from '@testing-library/react';
|
||||||
|
import configureStore from "redux-mock-store";
|
||||||
|
|
||||||
import BlogSearch from './blog-search';
|
import BlogSearch from './blog-search';
|
||||||
|
import {Provider} from "react-redux";
|
||||||
|
|
||||||
|
jest.mock("next/router", () => ({
|
||||||
|
useRouter() {
|
||||||
|
return {
|
||||||
|
route: "/",
|
||||||
|
pathname: "",
|
||||||
|
query: "",
|
||||||
|
asPath: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
describe('BlogSearch', () => {
|
describe('BlogSearch', () => {
|
||||||
|
const initialState = {results: []};
|
||||||
|
const mockStore = configureStore();
|
||||||
|
let store;
|
||||||
|
|
||||||
it('should render successfully', () => {
|
it('should render successfully', () => {
|
||||||
const { baseElement } = render(<BlogSearch />);
|
store = mockStore(initialState);
|
||||||
|
const {baseElement} = render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<BlogSearch />
|
||||||
|
</Provider>);
|
||||||
expect(baseElement).toBeTruthy();
|
expect(baseElement).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import HomeSectionBlog from './home-section-blog';
|
||||||
|
|
||||||
|
describe('HomeSectionBlog', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<HomeSectionBlog />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
/* eslint-disable-next-line */
|
||||||
|
import NextImage from "next/image";
|
||||||
|
import delve from 'dlv';
|
||||||
|
|
||||||
|
import {getCategoryUrl, getPostUrl, getStrapiImage, getStrapiImageSize} from "../../libs/utils";
|
||||||
|
import CardBlog from "../card-blog/card-blog";
|
||||||
|
import {format} from "date-fns";
|
||||||
|
|
||||||
|
export interface HomeSectionBlogProps {
|
||||||
|
posts: object[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HomeSectionBlog({posts = []}: HomeSectionBlogProps) {
|
||||||
|
const firstArticle = posts.length > 0 ? posts.slice(0, 1) : [];
|
||||||
|
const otherArticles = posts.length > 0 ? posts.slice(1, posts.length) : [];
|
||||||
|
const [width, height] = getStrapiImageSize(firstArticle[0]);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className="container max-w-6xl relative mx-auto relative flex flex-col md:flex-row mb-10 h-auto">
|
||||||
|
<div className="w-12/12 md:w-6/12 px-4 mb-4 md:mb-0 md:px-0 md:pr-2">
|
||||||
|
<div className="block border rounded-lg shadow-sm h-full my-2 mx-2 sm:my-0 sm:mx-0 relative
|
||||||
|
bg-white border-gray-200
|
||||||
|
dark:bg-gray-800 dark:border-gray-800 dark:hover:bg-gray-800">
|
||||||
|
<div className="flex justify-between items-center absolute left-5 top-5">
|
||||||
|
<span
|
||||||
|
className="font-bold shadow text-white text-sm">{format(new Date(delve(firstArticle[0], 'attributes.publishedAt', 'Jun 1, 2020')), 'dd/MM/yyyy')}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between items-center absolute right-5 top-5">
|
||||||
|
<a href={getCategoryUrl(firstArticle[0])}
|
||||||
|
className="px-2 py-1 text-sm bg-gray-600 text-gray-100 font-bold rounded hover:bg-gray-500">
|
||||||
|
{delve(firstArticle[0], 'attributes.category.data.attributes.name', 'N/A')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<NextImage
|
||||||
|
layout="responsive"
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
objectFit="contain"
|
||||||
|
className="rounded-t"
|
||||||
|
src={getStrapiImage(firstArticle[0])}
|
||||||
|
alt={delve(firstArticle, '0.title', 'N/A')} />
|
||||||
|
|
||||||
|
<main className="p-5">
|
||||||
|
<div className="mt-2">
|
||||||
|
<a
|
||||||
|
href={getPostUrl(firstArticle[0])}
|
||||||
|
className="text-xl font-bold hover:underline
|
||||||
|
text-gray-700
|
||||||
|
dark:text-gray-200">
|
||||||
|
{delve(firstArticle[0], 'attributes.title', 'N/A')}
|
||||||
|
</a>
|
||||||
|
<p className="mt-2 font-light text-sm
|
||||||
|
text-gray-600
|
||||||
|
dark:text-gray-300">{delve(firstArticle[0], 'attributes.description', 'N/A')}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-between items-center mt-4">
|
||||||
|
<a href={getPostUrl(firstArticle[0])}
|
||||||
|
className="text-blue-500 text-sm hover:underline">Lire l'article</a>
|
||||||
|
<div>
|
||||||
|
<a href="#"
|
||||||
|
className="flex items-center">
|
||||||
|
<img
|
||||||
|
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=731&q=80"
|
||||||
|
alt="avatar"
|
||||||
|
className="mx-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
|
||||||
|
<h3 className="text-normal font-bold hover:underline
|
||||||
|
text-gray-700
|
||||||
|
dark:text-gray-300">Alex John</h3>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-12/12 md:w-6/12 px-4 md:px-0 md:pl-2">
|
||||||
|
{otherArticles.map((item: object, index: number) => (<CardBlog key={"home-card-blog-" + index}
|
||||||
|
item={item} />))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeSectionBlog;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import HomeSectionCardsHeader from './home-section-cards-header';
|
||||||
|
|
||||||
|
describe('HomeSectionCardsHeader', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<HomeSectionCardsHeader />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
import styles from './home-section-cards-header.module.scss';
|
||||||
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||||
|
import {
|
||||||
|
faChalkboardUser,
|
||||||
|
faGraduationCap, faGuitar,
|
||||||
|
faLinesLeaning, faScrewdriverWrench,
|
||||||
|
faTabletScreenButton
|
||||||
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
/* eslint-disable-next-line */
|
||||||
|
export interface HomeSectionCardsHeaderProps {}
|
||||||
|
|
||||||
|
export function HomeSectionCardsHeader(props: HomeSectionCardsHeaderProps) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main className="container relative max-w-screen-xl mx-auto relative flex flex-col mb-10">
|
||||||
|
<section className="relative max-w-6xl w-full mx-auto lg:h-[200px] sm:grid sm:grid-cols-3 sm:gap-4 sm:-top-10 sm:px-4 xl:px-0">
|
||||||
|
<div className="block p-6 border rounded-lg shadow-sm h-full my-2 mx-2 sm:my-0 sm:mx-0
|
||||||
|
bg-white border-gray-200
|
||||||
|
hover:bg-gray-100
|
||||||
|
dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">a
|
||||||
|
</div>
|
||||||
|
<div className="block p-6 border rounded-lg shadow-sm h-full my-2 mx-2 sm:my-0 sm:mx-0
|
||||||
|
bg-white border-gray-200
|
||||||
|
hover:bg-gray-100
|
||||||
|
dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">b
|
||||||
|
</div>
|
||||||
|
<div className="blocks p-6 border rounded-lg shadow-sm h-full my-2 mx-2 sm:my-0 sm:mx-0
|
||||||
|
bg-white border-gray-200
|
||||||
|
hover:bg-gray-100
|
||||||
|
dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">c
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section className="relative w-full">
|
||||||
|
<h2 className="font-bold w-full text-center my-5 text-2xl mx-auto text-teal-800">MeCP fournit tout les outils nécessaire pour un apprentissage de qualité</h2>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-3 gap-2 md:gap-4 max-w-4xl mx-auto px-2 md:px-0">
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-lime-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faTabletScreenButton} /></span>
|
||||||
|
<span className="text-lg">Des formats adaptés</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-violet-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faGraduationCap} /></span>
|
||||||
|
<span className="text-lg">Une organisation pédagogique</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-yellow-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faChalkboardUser} /></span>
|
||||||
|
<span className="text-lg ">Un espace dédié à l'apprentissage</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-orange-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faLinesLeaning} /></span>
|
||||||
|
<span className="text-lg">Des contenus adaptés et motivants</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-teal-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faGuitar} /></span>
|
||||||
|
<span className="text-lg">Une méthode révolutionnaire</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-center flex flex-col transition scale-75
|
||||||
|
text-gray-400
|
||||||
|
hover:scale-100 hover:text-pink-600">
|
||||||
|
<span className="text-5xl my-2 md:mx-10 md:my-5"><FontAwesomeIcon icon={faScrewdriverWrench} /></span>
|
||||||
|
<span className="text-lg">Des outils interactifs</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeSectionCardsHeader;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import HomeSectionComments from './home-section-comments';
|
||||||
|
|
||||||
|
describe('HomeSectionComments', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<HomeSectionComments />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,186 @@
|
|||||||
|
/* eslint-disable-next-line */
|
||||||
|
export interface HomeSectionCommentsProps {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HomeSectionComments(props: HomeSectionCommentsProps) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className="w-full py-10 my-10
|
||||||
|
bg-white
|
||||||
|
dark:bg-gray-800">
|
||||||
|
<div className="container max-w-6xl relative mx-auto relative flex-col mb-10 h-auto">
|
||||||
|
<h3 className="w-full mb-10 text-xl text-center font-extrabold tracking-tight leading-none md:text-2xl xl:text-3xl dark:text-white">
|
||||||
|
Ce que nos étudiants en pense
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div className="w-full grid md:grid-cols-3 md:px-4 xl:px-0 gap-5">
|
||||||
|
<div className="rounded-lg p-7 mx-5 md:mx-0
|
||||||
|
bg-gray-100
|
||||||
|
dark:bg-gray-700">
|
||||||
|
<header>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>First star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Second star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Third star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fourth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-gray-300 dark:text-gray-500"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fifth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<section className="pt-3">
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec sodales nisi. Donec pretium varius purus quis porttitor. In et tempus massa, accumsan egestas orci. Aenean eros purus, consequat eget.</p>
|
||||||
|
</section>
|
||||||
|
<hr className="my-5" />
|
||||||
|
<footer className="flex items-center">
|
||||||
|
<img
|
||||||
|
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=731&q=80"
|
||||||
|
alt="avatar"
|
||||||
|
className="mr-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
|
||||||
|
<h3 className="text-gray-700 text-normal font-bold hover:underline text-slate-400">Par Alex John</h3>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<div className="rounded-lg p-7 mx-5 md:mx-0
|
||||||
|
bg-gray-100
|
||||||
|
dark:bg-gray-700">
|
||||||
|
<header>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>First star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Second star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Third star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fourth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-gray-300 dark:text-gray-500"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fifth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<section className="pt-3">
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec sodales nisi. Donec pretium varius purus quis porttitor. In et tempus massa, accumsan egestas orci. Aenean eros purus, consequat eget.</p>
|
||||||
|
</section>
|
||||||
|
<hr className="my-5" />
|
||||||
|
<footer className="flex items-center">
|
||||||
|
<img
|
||||||
|
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=731&q=80"
|
||||||
|
alt="avatar"
|
||||||
|
className="mr-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
|
||||||
|
<h3 className="text-gray-700 text-normal font-bold hover:underline text-slate-400">Par Alex John</h3>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<div className="rounded-lg p-7 mx-5 md:mx-0
|
||||||
|
bg-gray-100
|
||||||
|
dark:bg-gray-700">
|
||||||
|
<header>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>First star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Second star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Third star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-yellow-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fourth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
<svg aria-hidden="true"
|
||||||
|
className="w-5 h-5 text-gray-300 dark:text-gray-500"
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"><title>Fifth star</title>
|
||||||
|
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<section className="pt-3">
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec sodales nisi. Donec pretium varius purus quis porttitor. In et tempus massa, accumsan egestas orci. Aenean eros purus, consequat eget.</p>
|
||||||
|
</section>
|
||||||
|
<hr className="my-5" />
|
||||||
|
<footer className="flex items-center">
|
||||||
|
<img
|
||||||
|
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=731&q=80"
|
||||||
|
alt="avatar"
|
||||||
|
className="mr-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
|
||||||
|
<h3 className="text-gray-700 text-normal font-bold hover:underline text-slate-400">Par Alex John</h3>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeSectionComments;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import HomeSectionGrid from './home-section-grid';
|
||||||
|
|
||||||
|
describe('HomeSectionGrid', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<HomeSectionGrid />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
/* eslint-disable-next-line */
|
||||||
|
export interface HomeSectionGridProps {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HomeSectionGrid(props: HomeSectionGridProps) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className="w-full p-5 sm:p-10 lg:pt-0 lg:py-10 lg:my-10
|
||||||
|
bg-white
|
||||||
|
dark:bg-gray-800">
|
||||||
|
<div className="container max-w-6xl relative mx-auto relative flex row lg:mb-10 h-auto">
|
||||||
|
<div className="place-self-center lg:col-span-7 md:px-5 md:px-0 md:pr-10">
|
||||||
|
<h3 className="lg:max-w-2xl mb-4 lg:my-10 text-xl font-extrabold tracking-tight leading-none md:text-2xl xl:text-3xl
|
||||||
|
dark:text-white">
|
||||||
|
Méthode révolutionnaire pour apprendre à jouer
|
||||||
|
</h3>
|
||||||
|
<p className="lg:max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg
|
||||||
|
dark:text-gray-400">
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed feugiat nulla lorem, at consectetur ligula pulvinar nec. Fusce dictum aliquet tellus id aliquam. Praesent feugiat tincidunt ante. Aliquam non lectus est. Suspendisse porta, dolor vel aliquet pharetra, ipsum diam laoreet ante, a feugiat nisi justo eu est.
|
||||||
|
</p>
|
||||||
|
<p className="lg:max-w-2xl font-light text-gray-500 lg:mb-8 md:text-lg
|
||||||
|
dark:text-gray-400">
|
||||||
|
Suspendisse in eros nisl. Vivamus eu convallis massa. Phasellus sit amet felis ut velit semper sagittis eget vitae arcu. Nunc leo est, vulputate sed libero non, efficitur lobortis odio. Proin fermentum massa non metus bibendum imperdiet.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="hidden relative md:mt-10 lg:col-span-5 lg:flex grow justify-around">
|
||||||
|
<div className="md:w-2/5 relative bg-gray-200 rounded-lg h-[350px]"></div>
|
||||||
|
<div className="md:w-2/5 relative bg-gray-200 rounded-lg h-[350px] top-10"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeSectionGrid;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import HomeSectionVideo from './home-section-video';
|
||||||
|
|
||||||
|
describe('HomeSectionVideo', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<HomeSectionVideo />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
import styles from './home-section-video.module.scss';
|
||||||
|
|
||||||
|
/* eslint-disable-next-line */
|
||||||
|
export interface HomeSectionVideoProps {}
|
||||||
|
|
||||||
|
export function HomeSectionVideo(props: HomeSectionVideoProps) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className="container relative max-w-screen-xl mx-auto relative flex flex-col justify-center mb-10">
|
||||||
|
<h2 className="font-bold w-full text-center mt-5 text-2xl mx-auto text-blue-800">
|
||||||
|
Démonstration en vidéo
|
||||||
|
</h2>
|
||||||
|
<p className="text-lg text-gray-500 mb-10 text-center">Rien ne vaut une démonstration pour convaincre !</p>
|
||||||
|
|
||||||
|
<iframe src="https://embed.api.video/vod/vi2JpEFEClejM7A4hhn6i7fU"
|
||||||
|
width="90%"
|
||||||
|
frameBorder="0"
|
||||||
|
scrolling="no"
|
||||||
|
className="mx-auto"
|
||||||
|
allowFullScreen={true}></iframe>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeSectionVideo;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Replace this with your own classes
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* .container {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
|
import Home from './home';
|
||||||
|
|
||||||
|
describe('Home', () => {
|
||||||
|
it('should render successfully', () => {
|
||||||
|
const { baseElement } = render(<Home />);
|
||||||
|
expect(baseElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
import styles from './home.module.scss';
|
||||||
|
import HomeSectionGrid from "../home-section-grid/home-section-grid";
|
||||||
|
import HomeSectionCardsHeader from "../home-section-cards-header/home-section-cards-header";
|
||||||
|
import HomeSectionVideo from "../home-section-video/home-section-video";
|
||||||
|
import HomeSectionComments from "../home-section-comments/home-section-comments";
|
||||||
|
import HomeSectionBlog from "../home-section-blog/home-section-blog";
|
||||||
|
|
||||||
|
/* eslint-disable-next-line */
|
||||||
|
export interface HomeProps {
|
||||||
|
posts: object[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HomeContent({posts}: HomeProps) {
|
||||||
|
return (
|
||||||
|
<div className={styles['container']}>
|
||||||
|
<header className="w-full hidden sm:block min-h-[40vh] md:min-h-[50vh] lg:min-h-[75vh] bg-gray-500 bg-cover bg-no-repeat" style={{backgroundImage: 'url(/images/home.jpeg)'}}></header>
|
||||||
|
<HomeSectionCardsHeader />
|
||||||
|
<HomeSectionGrid />
|
||||||
|
<HomeSectionVideo />
|
||||||
|
<HomeSectionComments />
|
||||||
|
<HomeSectionBlog posts={posts} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeContent;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
appUrl: 'http://localhost:4200',
|
appUrl: 'http://localhost:4200',
|
||||||
strapiUrl: 'http://127.0.0.1:1337',
|
strapiUrl: 'http://localhost:1337',
|
||||||
strapiApiUrl: 'http://127.0.0.1:1337/api',
|
strapiApiUrl: 'http://localhost:1337/api',
|
||||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
|
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
|
||||||
meiliApiKey: "0e9a9d027b9e6b2d98c9670e5030a8d1aa72cab911fd768d4ad02636ae673690",
|
meiliUrl: "http://127.0.0.1:7700",
|
||||||
meiliMasterKey: "f2e963e883cbacf6d4f63e792dc276491b8a866fb837f3fda37b8b78889a6851"
|
meiliApiKey: "f2e963e883cbacf6d4f63e792dc276491b8a866fb837f3fda37b8b78889a6851",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
appUrl: 'http://localhost:4200',
|
appUrl: 'http://localhost:4200',
|
||||||
strapiUrl: 'http://127.0.0.1:1337',
|
strapiUrl: 'http://localhost:1337',
|
||||||
strapiApiUrl: 'http://127.0.0.1:1337/api',
|
strapiApiUrl: 'http://localhost:1337/api',
|
||||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
|
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
|
||||||
meiliApiKey: "0e9a9d027b9e6b2d98c9670e5030a8d1aa72cab911fd768d4ad02636ae673690",
|
meiliUrl: "http://127.0.0.1:7700",
|
||||||
meiliMasterKey: "f2e963e883cbacf6d4f63e792dc276491b8a866fb837f3fda37b8b78889a6851"
|
meiliApiKey: "dda9e4a354839db9ae18c3722ae75422515c06525b3a841010928b5256f54e72",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
import delve from 'dlv';
|
||||||
|
|
||||||
|
import {environment} from "../environments/environment";
|
||||||
|
|
||||||
|
export type ImageFormatType = "default" | "thumbnail" | "medium" | "small";
|
||||||
|
|
||||||
|
export const getCategoryUrl = (item): string => {
|
||||||
|
const categorySlug = !delve(item, 'attributes', null) ? delve(item, 'category.data.attributes.slug', '') : delve(item, 'attributes.category.data.attributes.slug', '');
|
||||||
|
return '/blog/' + categorySlug;
|
||||||
|
}
|
||||||
|
export const getPostUrl = (item): string => {
|
||||||
|
const categorySlug = !delve(item, 'attributes', null) ? delve(item, 'category.data.attributes.slug', '') : delve(item, 'attributes.category.data.attributes.slug', '');
|
||||||
|
const postSlug = !delve(item, 'attributes', null) ? delve(item, 'slug', '') : delve(item, 'attributes.slug', '');
|
||||||
|
return '/blog/' + categorySlug + '/' + postSlug;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStrapiImage = (item, format: ImageFormatType = 'default') => {
|
||||||
|
const image = !delve(item, 'attributes', null) ? delve(item, 'image.data.attributes', {}) : delve(item, 'attributes.image.data.attributes', {});
|
||||||
|
console.log(item, image);
|
||||||
|
switch (format) {
|
||||||
|
case "default":
|
||||||
|
return environment.strapiUrl + delve(image, "url", "/images/default.png");
|
||||||
|
case "medium":
|
||||||
|
return environment.strapiUrl + delve(image, "formats.medium.url", "/images/default.png");
|
||||||
|
case "small":
|
||||||
|
return environment.strapiUrl + delve(image, "formats.small.url", "/images/default.png");
|
||||||
|
case "thumbnail":
|
||||||
|
return environment.strapiUrl + delve(image, "formats.thumbnail.url", "/images/default.png");
|
||||||
|
default:
|
||||||
|
return environment.strapiUrl + delve(image, "url", "/images/default.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const getStrapiImageSize = (item, format: ImageFormatType = 'default'): [number, number] => {
|
||||||
|
const image = delve(item, 'attributes.image.data.attributes', {});
|
||||||
|
switch (format) {
|
||||||
|
case "default":
|
||||||
|
return [delve(image, "width", 100), delve(image, "height", 100)];
|
||||||
|
case "medium":
|
||||||
|
return [delve(image, "formats.medium.width", 100), delve(image, "formats.medium.height", 100)];
|
||||||
|
case "small":
|
||||||
|
return [delve(image, "formats.small.width", 100), delve(image, "formats.small.height", 100)];
|
||||||
|
case "thumbnail":
|
||||||
|
return [delve(image, "formats.thumbnail.width", 100), delve(image, "formats.thumbnail.height", 100)];
|
||||||
|
default:
|
||||||
|
return [delve(image, "width", 100), delve(image, "height", 100)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 254 KiB |
Loading…
Reference in new issue