Skip to content

Commit

Permalink
react-boilerplate#9: add lazy loading img
Browse files Browse the repository at this point in the history
  • Loading branch information
Thinh922001 committed Sep 25, 2024
1 parent 1fd934b commit 0f36306
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Header/sub-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const SubMenu: React.FC<SubMenuProps> = ({ data = [], title = '' }) => {
return (
<A href="#!" key={index}>
<SubMenuItem>
<ItemImg src={e.img} />
<ItemImg src={e.img} alt={e.desc} loading="lazy" />
<ItemDesc>{e.desc}</ItemDesc>
</SubMenuItem>
</A>
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/MyHomePage/components/render-cate-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import styled from 'styled-components/macro';

export const renderCategoryItems = (items: SubMenuType[]) =>
items.map((item, index) => (
<A key={index}>
<A key={index} href="#!">
<CateItem>
<CateImg src={item.img} alt={item.desc} />
<CateImg src={item.img} alt={item.desc} loading="lazy" />
<CateDesc>{item.desc}</CateDesc>
</CateItem>
</A>
Expand Down
2 changes: 0 additions & 2 deletions src/app/pages/MyHomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import MyHeader from 'app/components/Header';
import styled from 'styled-components/macro';
import { Container } from 'app/components/container';
import { Banner } from './components/banner';
import { Category } from './components/category';
Expand Down

0 comments on commit 0f36306

Please sign in to comment.