Skip to content

Commit

Permalink
Merge pull request #62 from fs-jun24-team-3/global-fixes
Browse files Browse the repository at this point in the history
Global fixes
  • Loading branch information
k-marchuk authored Sep 24, 2024
2 parents dfb0be2 + 0e1c6a8 commit 023ddb0
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 66 deletions.
1 change: 0 additions & 1 deletion src/components/Breadcrumbs/Breadcrumbs.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.breadcrumbs {
list-style: none;
padding: 0;
margin: 24px 0 0;

display: flex;
align-items: center;
Expand Down
7 changes: 2 additions & 5 deletions src/components/Catalog/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Dropdown } from '../Dropdown';
import { ItemsPerPageDropdown } from '../ItemsPerPageDropdown';
import { useLocation, useNavigate } from 'react-router-dom';
import { sortProducts } from '../../utils/helpers/sortProducts';
import { Breadcrumbs } from '../Breadcrumbs';

type Props = {
items: UnionProduct[];
Expand Down Expand Up @@ -107,11 +108,7 @@ export const Catalog: React.FC<Props> = ({ items, title, isFiltered }) => {
return (
<>
<div className={styles.phones}>
<div className={styles.phones__routs}>
<div className={styles.phones__routs__home}></div>
<div className={styles.phones__routs__array}></div>
<div className={styles.phones__routs__currentPage}>Phones</div>
</div>
<Breadcrumbs />
<div className={styles.phones__title}>{title}</div>
<div className={styles.phones__countModel}>{items.length} models</div>
{isFiltered && (
Expand Down
52 changes: 29 additions & 23 deletions src/components/Loading/Loading.module.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
.loader {
margin: 20px;
width: 40px;
height: 40px;
border: 3px solid $accent-color;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
.loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 46px;
height: 46px;
border-radius: 50%;
border: 3px solid transparent;
border-bottom-color: $secondary-color;
.loader-block {
display: flex;
justify-content: center;

&__element {
margin: 20px;
width: 40px;
height: 40px;
border: 3px solid $accent-color;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;

&::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 46px;
height: 46px;
border-radius: 50%;
border: 3px solid transparent;
border-bottom-color: $secondary-color;
}
}
}

@keyframes rotation {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Loading/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ import styles from './Loading.module.scss';
type Props = {};

export const Loading: React.FC<Props> = () => {
return <span className={styles.loader}></span>;
return (
<div className={styles['loader-block']}>
<span className={styles['loader-block__element']}></span>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.categorie {
grid-column: span 4;
text-decoration: none;
margin-bottom: 32px;
transition: transform 1s;

&:hover {
transform: scale(105%);
}

@include onDesktop {
grid-column: span 8;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const CategoriesItem: React.FC<Props> = ({ img, title, text, link }) => {
<div className="categorie">
<NavLink to={link}>
<img className="categorie__img" src={img} />
<div className="categorie__title">{title}</div>
<div className="categorie__text">{text}</div>
</NavLink>
<div className="categorie__title">{title}</div>
<div className="categorie__text">{text}</div>
</div>
);
};
4 changes: 4 additions & 0 deletions src/components/Main/GoodsSlider/GoodSlider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
margin: 0;
list-style: none;
column-gap: 16px;

> div {
padding: 13px;
}
}

.slider__list::-webkit-scrollbar {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Main: React.FC<Props> = () => {
<MainBannerSlider />
<GoodsSlider sliderTitle={'Brand new models'} productsList={phones} />
<CategoriesList />
<GoodsSlider sliderTitle={'Brand new models'} productsList={phones} />;
<GoodsSlider sliderTitle={'Brand new models'} productsList={phones} />
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/PhoneCard/PhoneCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const PhoneCard: React.FC<Props> = ({ item }) => {
alt="phone logo"
className="card__logo"
/>
<p className="card__title">{name}</p>
</Link>
<p className="card__title">{name}</p>
<div className="card__inform">
<p className="card__price">${priceRegular}</p>
<p className="card__separator"></p>
Expand Down
11 changes: 1 addition & 10 deletions src/components/ProductDetails/About/About.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
}

.sectionTitle {
font-size: 20px;
line-height: 26px;
font-weight: 700;
color: $primary-color;

@include onTablet {
Expand All @@ -37,17 +34,11 @@
gap: 8px;

@include onTablet {
font-size: 20px;
line-height: 26px;
font-weight: 600;
color: $primary-color;
}
}

.descriptionText {
font-size: 14px;
font-weight: 600;
line-height: 21px;

color: $secondary-color;
font-weight: 500;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const VariantsActions: React.FC<Props> = ({
</VariantsBlock>
<div className={styles['variants-block__line']} />
<div className={styles['variants-block__price']}>
<h2>${priceRegular}</h2>
<p>${priceDiscount}</p>
<h2>${priceDiscount}</h2>
<p>${priceRegular}</p>
</div>
<div className="variants-block__actions">
<ProductActions size={ButtonSize.Large} item={product} />
Expand Down
20 changes: 12 additions & 8 deletions src/pages/AccessoriesPage/AccessoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@ import { useAppDispatch, useAppSelector } from '../../app/reduxHooks';
import { RootState } from '../../app/store';
import { loadAccessories } from '../../app/slices/accessoriesSlice';
import { Catalog } from '../../components/Catalog/Catalog';
import { Loading } from '../../components/Loading';
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};

export const AccessoriesPage: React.FC<Props> = () => {
const dispatch = useAppDispatch();
const accessories = useAppSelector(
(state: RootState) => state.accessories.accessories,
);

const { accessories, loading } = useAppSelector((state: RootState) => ({
accessories: state.accessories.accessories,
loading: state.accessories.isAccessoryLoading,
}));

useEffect(() => {
dispatch(loadAccessories());
}, [dispatch]);

if (loading || !accessories.length) {
return <Loading />;
}

return (
<>
<Catalog
items={accessories}
title={'Accessories phones'}
isFiltered={true}
/>
<Catalog items={accessories} title={'Accessories'} isFiltered={true} />
</>
);
};
2 changes: 1 addition & 1 deletion src/pages/FavoritesPage/FavoritesPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Catalog } from '../../components/Catalog/Catalog';
import { Breadcrumbs } from '../../components/Breadcrumbs/Breadcrumbs';
// import styles from './FavoritesPage.module.scss';
import { useAppSelector } from '../../app/reduxHooks';
import { RootState } from '../../app/store';
import { Breadcrumbs } from '../../components/Breadcrumbs';

export const FavoritesPage = () => {
//в цій компоненті я передію не данні favorites, а данні accessories(це заглушка).
Expand Down
16 changes: 10 additions & 6 deletions src/pages/PhonesPage/PhonesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ import { loadPhones } from '../../app/slices/phonesSlice';
import { RootState } from '../../app/store';
import { useAppDispatch, useAppSelector } from '../../app/reduxHooks';
import { Catalog } from '../../components/Catalog/Catalog';
import { Loading } from '../../components/Loading';
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};

export const PhonesPage: React.FC<Props> = () => {
const dispatch = useAppDispatch();
const phones = useAppSelector((state: RootState) => state.phones.phones);
const { phones, loading } = useAppSelector((state: RootState) => ({
phones: state.phones.phones,
loading: state.phones.isPhonesLoading,
}));

useEffect(() => {
dispatch(loadPhones());
}, [dispatch]);

return (
<>
<Catalog items={phones} title={'Mobile phones'} isFiltered={true} />
</>
);
if (loading || !phones.length) {
return <Loading />;
}

return <Catalog items={phones} title={'Mobile phones'} isFiltered={true} />;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.container {
@include container();
padding-top: 24px;
}

.loading-wrapper {
Expand Down
14 changes: 12 additions & 2 deletions src/pages/TabletspPage/TabletsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@ import { Catalog } from '../../components/Catalog/Catalog';
import { useAppDispatch, useAppSelector } from '../../app/reduxHooks';
import { RootState } from '../../app/store';
import { loadTablets } from '../../app/slices/tabletsSlice';
import { Loading } from '../../components/Loading';
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};

export const TabletsPage: React.FC<Props> = () => {
const dispatch = useAppDispatch();
const tablets = useAppSelector((state: RootState) => state.tablets.tablets);

const { tablets, loading } = useAppSelector((state: RootState) => ({
tablets: state.tablets.tablets,
loading: state.tablets.isTabletsLoading,
}));

useEffect(() => {
dispatch(loadTablets());
}, [dispatch]);

if (loading || !tablets.length) {
return <Loading />;
}

return (
<>
<Catalog items={tablets} title={'Tablets phones'} isFiltered={true} />
<Catalog items={tablets} title={'Tablets'} isFiltered={true} />
</>
);
};
6 changes: 3 additions & 3 deletions src/styles/utils/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@
height: 100%;
@include onMobile {
width: 212px;
height: 439px;
// height: 439px;
}

@include onTablet {
width: 237px;
height: 512px;
// height: 512px;
}

@include onDesktop {
width: 272px;
height: 506px;
// height: 506px;
}
}

Expand Down

0 comments on commit 023ddb0

Please sign in to comment.