Skip to content

Commit

Permalink
feat(website): implement demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
aymericzip committed Jun 14, 2024
1 parent e860f68 commit 9115caa
Show file tree
Hide file tree
Showing 12 changed files with 656 additions and 33 deletions.
1 change: 1 addition & 0 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"react": "^18",
"react-dom": "^18",
"react-syntax-highlighter": "^15.5.0",
"sharp": "^0.33.4",
"tailwind-merge": "^2.3.0"
},
"devDependencies": {
Expand Down
86 changes: 57 additions & 29 deletions apps/website/public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ if (!self.define) {
return e;
})
);
self.define = (n, t) => {
const i =
self.define = (n, i) => {
const t =
e ||
('document' in self ? document.currentScript.src : '') ||
location.href;
if (s[i]) return;
if (s[t]) return;
let c = {};
const r = (e) => a(e, i),
o = { module: { uri: i }, exports: c, require: r };
s[i] = Promise.all(n.map((e) => o[e] || r(e))).then((e) => (t(...e), c));
const f = (e) => a(e, t),
r = { module: { uri: t }, exports: c, require: f };
s[t] = Promise.all(n.map((e) => r[e] || f(e))).then((e) => (i(...e), c));
};
}
define(['./workbox-d25a3628'], function (e) {
Expand All @@ -36,75 +36,95 @@ define(['./workbox-d25a3628'], function (e) {
[
{
url: '/_next/app-build-manifest.json',
revision: 'c525fe61491dffbcb139576b197714a3',
revision: 'f9ed72cd583d072d46b65f6302a416d3',
},
{
url: '/_next/static/SvT_7Fy1yW2Ck1AsvtgZ2/_buildManifest.js',
url: '/_next/static/NGf9mfNfV7zSrbxQUqKEd/_buildManifest.js',
revision: 'f97b2def7f98ec227a1c507e0a83564d',
},
{
url: '/_next/static/SvT_7Fy1yW2Ck1AsvtgZ2/_ssgManifest.js',
url: '/_next/static/NGf9mfNfV7zSrbxQUqKEd/_ssgManifest.js',
revision: 'b6652df95db52feb4daf4eca35380933',
},
{
url: '/_next/static/chunks/162-2e29433d96f8a782.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/263-26998d1cd824c303.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/30-e104eb02de646f7a.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/449-0082d8adab06dfff.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/638-c1550727713b3f21.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/966-0860d8fc554aaccd.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/app/%5Blocale%5D/demo/page-7263333c68ef7318.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/app/%5Blocale%5D/page-405e055d0131836b.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/app/%5Blocale%5D/layout-fd3121244f422f90.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/app/%5Blocale%5D/page-2d2d50e5447bbcbb.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/app/_not-found/page-ad827f9776c69944.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/app/layout-f2caeb2dfd9a1b93.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/app/layout-ddcea0d40aa0c318.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/d852bed0-a17b81a349efd4a3.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/framework-e2992f489174322a.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/main-app-27600e3f07a0383d.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/main-27e7b21c454e05d3.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/main-e9c143591829e969.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/main-app-27600e3f07a0383d.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/pages/_app-0f3026d4bb6981d3.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/pages/_error-d8ffda56f6a89f4b.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js',
revision: '79330112775102f91e1010318bae2bd3',
},
{
url: '/_next/static/chunks/webpack-6e7e8d847905ac5e.js',
revision: 'SvT_7Fy1yW2Ck1AsvtgZ2',
url: '/_next/static/chunks/webpack-5f3c6c2d08dd3e31.js',
revision: 'NGf9mfNfV7zSrbxQUqKEd',
},
{
url: '/_next/static/css/2f71e0d51b6954c9.css',
revision: '2f71e0d51b6954c9',
},
{
url: '/_next/static/css/8f0dfaa86d94aa40.css',
revision: '8f0dfaa86d94aa40',
url: '/_next/static/css/837264de9abe11c7.css',
revision: '837264de9abe11c7',
},
{
url: '/_next/static/media/05a31a2ca4975f99-s.woff2',
Expand All @@ -126,6 +146,10 @@ define(['./workbox-d25a3628'], function (e) {
url: '/_next/static/media/d6b16ce4a6175f26-s.woff2',
revision: 'dd930bafc6297347be3213f22cc53d3e',
},
{
url: '/_next/static/media/dark-screenshot.d29d9197.png',
revision: '516ee60fd30b2b82165e6f7eb98d7d7f',
},
{
url: '/_next/static/media/ec159349637c90ad-s.woff2',
revision: '0e89df9522084290e01e4127495fae99',
Expand All @@ -134,6 +158,10 @@ define(['./workbox-d25a3628'], function (e) {
url: '/_next/static/media/fd4db3eb5472fc27-s.woff2',
revision: '71f3fcaf22131c3368d9ec28ef839831',
},
{
url: '/_next/static/media/light-screenshot.39ab6bdb.png',
revision: '700bb42cdd1e1eaa93e9a3ad18b0fad5',
},
{
url: '/assets/android-chrome-192x192.png',
revision: 'd4a0ea8783eb3f40312ceed37f4750e2',
Expand Down
6 changes: 4 additions & 2 deletions apps/website/src/app/[locale]/demo/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { LandingPage } from '@components/LandingPage';
import { DemoPage } from '@components/DemoPage';
import { PageLayout } from '@layouts/PageLayout';
import type { NextPageIntlayer } from 'next-intlayer';
import { generateMetadata } from './metadata';

export { generateMetadata };

const Page: NextPageIntlayer = ({ params: { locale } }) => (
<PageLayout locale={locale}>{''}</PageLayout>
<PageLayout locale={locale}>
<DemoPage />
</PageLayout>
);
export default Page;
19 changes: 19 additions & 0 deletions apps/website/src/components/DemoPage/AnimatedDiv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client';

import { motion } from 'framer-motion';
import type { FC, HTMLAttributes, ReactNode } from 'react';

type AnimatedDivProps = {
children?: ReactNode;
} & Pick<HTMLAttributes<HTMLDivElement>, 'className'>;

export const AnimatedDiv: FC<AnimatedDivProps> = ({ children, ...props }) => (
<motion.div
initial={{ opacity: 0, translateY: '100px' }}
whileInView={{ opacity: 1, translateY: '0px' }}
viewport={{ once: false }}
{...props}
>
{children}
</motion.div>
);
29 changes: 29 additions & 0 deletions apps/website/src/components/DemoPage/AnimatedTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client';

import { motion } from 'framer-motion';
import React, { type HTMLAttributes, type FC } from 'react';

type AnimatedDescriptionProps = Pick<
HTMLAttributes<HTMLParagraphElement>,
'className' | 'children'
>;

// AnimatedCharacters
// Handles the deconstruction of each word and character to setup for the
// individual character animations
export const AnimatedTitle: FC<AnimatedDescriptionProps> = ({
children,
...props
}) => (
<motion.p
initial={{ opacity: 0 }}
whileInView={{ opacity: 1 }}
viewport={{ once: false }}
transition={{
delay: 0.8,
}}
{...props}
>
{children}
</motion.p>
);
17 changes: 17 additions & 0 deletions apps/website/src/components/DemoPage/AsideImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use client';

import Image from 'next/image';
import { useIntlayer } from 'next-intlayer';
import { useTheme } from 'next-themes';
import type { FC } from 'react';
import DarkScreenshot from './assets/dark-screenshot.png';
import LightScreenshot from './assets/light-screenshot.png';

export const AsideImage: FC = () => {
const { theme } = useTheme();
const { imageAlt } = useIntlayer('demo-page');

const src = theme === 'dark' ? LightScreenshot : DarkScreenshot;

return <Image src={src} alt={imageAlt.value} />;
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions apps/website/src/components/DemoPage/demo.content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { t, type DeclarationContent } from 'intlayer';

const demoContent: DeclarationContent = {
id: 'demo-page',
title: t({
fr: 'Essayez le nouvel éditeur visuel Intlayer',
en: 'Try the new Intlayer visual editor',
es: 'Pruebe el nuevo editor visual de Intlayer',
}),
landingParagraph: t({
fr: 'Déléguez la gestion de votre contenu à vos équipes en transformant votre application en CMS en un clique.',
en: 'Delegate content management to your teams by transforming your application into a CMS with a single click.',
es: 'Delegue la gestión de su contenido a sus equipos transformando su aplicación en un CMS con un solo clic.',
}),
imageAlt: t({
fr: "Capture d'écran de l'éditeur Intlayer",
en: 'Screenshort of the Intlayer editor',
es: 'Captura de pantalla del editor de Intlayer',
}),

tutoParagraphs: [
{
title: t({
fr: 'Sélectionnez le contenu à modifier',
en: 'Hover over the content to be modified',
es: 'Pase el cursor sobre el contenido a modificar',
}),
description: t({
fr: "Exercez un clic prolongé pour faire apparaître l'éditeur visuel. Le panneau d'édition s'étend de la droite et met en évidence le contenu sélectionné pour édition.",
en: 'Press and hold to make the visual editor appear. The editing panel extends from the right, highlighting the content selected for editing.',
es: 'Mantenga presionado para que aparezca el editor visual. El panel de edición se extiende desde la derecha y resalta el contenido seleccionado para editar.',
}),
},
{
title: t({
fr: 'Faites vos modifications en remplaçant le texte concerné',
en: 'Make your modifications by replacing the relevant text',
es: 'Realice sus modificaciones reemplazando el texto correspondiente',
}),
description: t({
fr: "Le texte mis en évidence dans le panneau d'édition peut être modifié ou remplacé à guise. Les modifications apparaîtront instantanément sur la page principale, facilitant la révision du contenu. Pour annuler les changements apportés, cliquez sur la croix.",
en: 'The highlighted text in the editing panel can be modified or replaced at will. The changes will appear instantly on the main page, making it easy to review the content. To undo the changes made, click on the cross.',
es: 'El texto resaltado en el panel de edición puede modificarse o reemplazarse a voluntad. Los cambios aparecerán instantáneamente en la página principal, facilitando la revisión del contenido. Para deshacer los cambios realizados, haga clic en la cruz.',
}),
},
{
title: t({
fr: 'Validez vos changements',
en: 'Confirm your changes',
es: 'Confirme sus cambios',
}),
description: t({
fr: 'Une fois vos changements effectués, validez les modifications apportées au champ concerné, puis validez les changements apportés au dictionnaire. Lorsque les changements apportés au dictionnaire sont validés, Intlayer écrira les modifications dans le fichier concerné.',
en: 'Once your changes are made, validate the modifications made to the relevant field, then confirm the changes made to the dictionary. When the changes to the dictionary are validated, Intlayer will write the modifications to the relevant file.',
es: 'Una vez realizados los cambios, valide las modificaciones hechas en el campo correspondiente, luego confirme los cambios hechos en el diccionario. Cuando se validen los cambios en el diccionario, Intlayer escribirá las modificaciones en el archivo correspondiente.',
}),
},
],

tryItByYourself: {
title: t({
fr: 'Essayez-le par vous-même',
en: 'Try it by yoursef',
es: 'Pruébelo usted mismo',
}),
},
};

export default demoContent;
40 changes: 40 additions & 0 deletions apps/website/src/components/DemoPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useIntlayer } from 'next-intlayer/server';
import type { FC } from 'react';
import { AnimatedDiv } from './AnimatedDiv';
import { AnimatedTitle } from './AnimatedTitle';
import { AsideImage } from './AsideImage';

export const DemoPage: FC = () => {
const { title, landingParagraph, tutoParagraphs } = useIntlayer('demo-page');

return (
<div className="m-auto flex w-full flex-col p-20 md:size-full">
<div className="flex h-[70vh] w-full flex-col items-center gap-10">
<div className="max-w-[500px]">
<AsideImage />
</div>
<div>
<AnimatedTitle className="mb-3 mt-24 text-4xl font-bold">
{title}
</AnimatedTitle>
<p className="text-neutral text-md">{landingParagraph}</p>
</div>
</div>
<div className="relative mx-auto my-10 flex max-w-[700px] flex-col gap-28">
{tutoParagraphs.map((paragraph, index) => (
<AnimatedDiv key={index} className="flex gap-10">
<span className="flex size-12 shrink-0 items-center justify-center rounded-full border-4 border-lime-300 text-xl font-black text-lime-800 dark:border-lime-900 dark:text-lime-600">
<span>{index + 1}</span>
</span>
<div>
<h3 className="mb-2 text-lg font-semibold">{paragraph.title}</h3>
<p className="text-neutral text-sm">{paragraph.description}</p>
</div>
</AnimatedDiv>
))}
</div>

{/* <h2>{tryItByYourself.title}</h2> */}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export const WhyToChoseIntlayerSection: FC = () => {
className="flex max-w-[200px] flex-col items-center gap-3 text-center"
key={index}
>
<span className="flex size-10 items-center justify-center rounded-full border-4 border-lime-300 text-2xl text-lime-800 dark:border-lime-900 dark:text-lime-600">
<span className="flex size-12 items-center justify-center rounded-full border-4 border-lime-300 text-2xl text-lime-800 dark:border-lime-900 dark:text-lime-600">
{index}
</span>
<h3 className="text-xl">{asset.title}</h3>
<h3 className="text-lg font-semibold">{asset.title}</h3>
<AnimatedDiv>
<p className="text-neutral text-xs">{asset.descrition}</p>
</AnimatedDiv>
Expand Down
Loading

0 comments on commit 9115caa

Please sign in to comment.