Skip to content

Commit

Permalink
🚑 Add .env files and update paths for assets and public URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratchitta committed Mar 17, 2024
1 parent d5c4945 commit 257edd8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_PUBLIC_URL=/wdb-sandbox/
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_PUBLIC_URL=/wdb-sandbox/
VITE_TAILWIND_ASSETS_URL=/wdb-sandbox/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://mkmksgit.github.io/wdb-sandbox/",
"type": "module",
"scripts": {
"start": "vite",
"start": "vite --mode development",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
"prettier": "prettier --write .",
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const Footer = (props: FooterProps) => {
<div className={'flex gap-2'}>
<p className={'text-caption'}>Powerd By</p>
<div className={'flex items-center gap-2'}>
<img src="/assets/skooldio-logo.png" alt="Skooldio" />
<img src={`${import.meta.env.VITE_PUBLIC_URL}assets/skooldio-logo.png`} alt="Skooldio" />
<div className="inline-block w-px self-stretch bg-neutral-100"></div>
<img src="/assets/web-dev-logo.png" alt="Web Development Bootcamp" />
<img src={`${import.meta.env.VITE_PUBLIC_URL}assets/web-dev-logo.png`} alt="Web Development Bootcamp" />
</div>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/Components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
type NavBarProps = {
tabList: string[];
// eslint-disable-next-line no-unused-vars
handleClickTab: (tab: string) => void;
handleClickLogo: () => void;
rightAdornment?: React.ReactNode;
Expand All @@ -13,7 +14,11 @@ const NavBar = (props: NavBarProps) => {
<div id="navbar-content" className="flex justify-between items-center">
<div id="left" className="flex gap-10 items-center">
<div id="logo" className="cursor-pointer flex gap-2.5 items-center" onClick={handleClickLogo}>
<img className="w-[36px] h-[36px] object-contain" src="/assets/logo.svg" alt="logo" />
<img
className="w-[36px] h-[36px] object-contain"
src={`${import.meta.env.VITE_PUBLIC_URL}assets/logo.svg`}
alt="logo"
/>
<p className="text-subHeading">WDB</p>
</div>
<div className="flex gap-6">
Expand Down
9 changes: 5 additions & 4 deletions src/Routes/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import CollectionDetails from '@/Routes/Home/Containers/CollectionDetails';
const Home = () => {
return (
<div>
<div
id="home-cover"
className={'h-[420px] bg-cover bg-center overflow-hidden bg-[url("assets/images/cover.png")]'}
></div>
<img
className="w-full h-[420px] object-cover object-center overflow-hidden"
src={`${import.meta.env.VITE_PUBLIC_URL}assets/images/cover.png`}
alt="cover of wdb shop, 5 people walk on the street with colorful cloths"
/>
<div id="home-container" className={'px-40 pt-24 pb-40 flex flex-col justify-center'}>
<CollectionDetails />
<div id="home-product">
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/ProductList/ProductList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ProductList = () => {
<p className={'text-h5'}>{title}</p>
<div id="product-list-sort-box"></div>
</div>
<div className={`grid grid-cols-${COLUMNS_PER_ROW} gap-x-10 gap-y-[60px]`}>
<div className={`grid grid-cols-4 gap-x-10 gap-y-[60px]`}>
{currentProducts.map((product) => {
const { id, name, description, price, promotionalPrice, ratings, imageUrls } = product;
return (
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"target": "es6",
"useDefineForClassFields": true,
"lib": ["es6", "DOM", "DOM.Iterable"],
"module": "es6",
"module": "esnext",
"skipLibCheck": true,

/* Bundler mode */
Expand Down

0 comments on commit 257edd8

Please sign in to comment.