Skip to content

Commit

Permalink
feat: use mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
yuval-hazaz committed Feb 5, 2024
1 parent 67ff319 commit ab61057
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/Common/PageHero/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const PageHero = ({
};

PageHero.propTypes = {
title: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
subTitle: PropTypes.string,
subText: PropTypes.string,
mainButton: PropTypes.shape({
Expand Down
8 changes: 6 additions & 2 deletions components/Sections/Enterprise/HeroBlock/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Lottie from 'lottie-react';
import { useCallback } from 'react';
import * as analytics from '../../../../lib/analytics';
import animationData from '../../../../lottie/amplication-how-to-transparent.json';
import videoSrc from '../../../../public/animation/amplication-how-to.mp4';
import PageHero from '../../../Common/PageHero';

const HeroBlock = () => {
Expand Down Expand Up @@ -51,7 +51,11 @@ const HeroBlock = () => {
buttonLocation: 'hero',
},
}}
imageNode={<Lottie animationData={animationData} loop={true} />}
imageNode={
<video autoPlay loop muted style={{ width: '100%', height: 'auto' }}>
<source src={videoSrc} type="video/mp4" />
</video>
}
/>
</>
);
Expand Down
17 changes: 16 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,26 @@ const nextConfig = {
];
},
swcMinify: true,
webpack: (config) => {
webpack: (config, { dev, isServer }) => {
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader',
});
// Use file-loader to load mp4 files.
const prefix = config.assetPrefix ?? config.basePath ?? '';
config.module.rules.push({
test: /\.mp4$/,
use: [
{
loader: 'file-loader',
options: {
publicPath: `${prefix}/_next/static/media/`,
outputPath: `${isServer ? '../' : ''}static/media/`,
name: '[name].[hash].[ext]',
},
},
],
});
return config;
},
};
Expand Down
Binary file added public/animation/amplication-how-to.mp4
Binary file not shown.

0 comments on commit ab61057

Please sign in to comment.