Skip to content

Commit

Permalink
feat(catalogue): flexible design
Browse files Browse the repository at this point in the history
  • Loading branch information
bas-kirill committed Aug 25, 2024
1 parent 928e360 commit 9f1b6fa
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 49 deletions.
1 change: 1 addition & 0 deletions client/src/app/App.css → client/src/app/App.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:root {
box-sizing: border-box;

}

body {
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import "./App.css";
import "./App.scss";
import {
createBrowserRouter,
createRoutesFromElements,
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/catalogue/ui/Catalogue.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from "react";
import styles from "./styles/Catalogue.page.module.css";
import styles from "./styles/Catalogue.page.module.scss";
import { HeaderWidget } from "widgets/header";
import { FooterWidget } from "widgets/footer";
import { useLoaderData } from "react-router-dom";
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/catalogue/ui/SearchBarInput.field.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import styles from "./styles/SearchBarInput.field.module.css";
import styles from "./styles/SearchBarInput.field.module.scss";
import { InstrumentName } from "generated/model";
import { Filters } from "widgets/catalogue-filter";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./Catalogue.page.queries.module.css";
@use "shared/styles/vars" as vars;

.catalogue__wrapper {
display: flex;
Expand All @@ -20,3 +20,9 @@
display: flex;
flex-direction: column;
}

@media (max-width: vars.$media_threshold) {
.catalogue__filters__serp__navbar__wrapper {
flex-direction: column;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@use "shared/styles/vars" as vars;

.search_bar__input {
font-size: 2em;
text-align: start;
border: 1px #dee2e6 solid;
}

@media (max-width: vars.$media_threshold) {
.search_bar__input {
font-size: 1.5em;
}
}
2 changes: 1 addition & 1 deletion client/src/pages/home/ui/Home.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import styles from "./styles/Home.page.module.css";
import styles from "./styles/Home.page.module.scss";
import "react-slideshow-image/dist/styles.css";
import { HeaderWidget } from "widgets/header";
import { FooterWidget } from "widgets/footer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "shared/styles/vars" as vars;

.home {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -64,7 +66,7 @@
margin: 0 15px;
}

@media (max-width: 570px) {
@media (max-width: vars.$media_threshold) {
.home {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.instrument_card {
width: 50%;
/*width: 50%;*/
display: flex;
flex-direction: column;
border: 1px #dee2e6 solid;
Expand Down
1 change: 1 addition & 0 deletions client/src/shared/styles/vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$media_threshold: 570px;
35 changes: 20 additions & 15 deletions client/src/widgets/catalogue-filter/ui/SidebarFilter.widget.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import styles from "./styles/SidebarFilter.widget.module.css";
import styles from "./styles/SidebarFilter.widget.module.scss";
import { Filters } from "widgets/catalogue-filter";
import { Role } from "domain/model/role";
import Jwt from "domain/model/jwt";
Expand All @@ -9,7 +9,7 @@ import {
Country,
ManufactureDate,
ManufacturerName,
ReleaseDate,
ReleaseDate
} from "generated/model";
import { InstrumentTypeFilter } from "widgets/catalogue-filter/ui/filters/InstrumentType.filter";
import { ManufacturerNameFilter } from "widgets/catalogue-filter/ui/filters/ManufacturerName.filter";
Expand All @@ -35,7 +35,7 @@ export const SidebarFilterWidget = (props: Props) => {
const [manufactureDateTo, setManufactureDateTo] =
useState<ManufactureDate | null>(null);
const [releaseDateFrom, setReleaseDateFrom] = useState<ReleaseDate | null>(
null,
null
);
const [releaseDateTo, setReleaseDateTo] = useState<ReleaseDate | null>(null);
const [countries, setCountries] = useState<Country[] | null>(null);
Expand All @@ -52,7 +52,7 @@ export const SidebarFilterWidget = (props: Props) => {
releaseDateTo: releaseDateTo,
countries: countries,
materials: materials,
instrumentIds: null, // there is no such form field to search by instrument ids
instrumentIds: null // there is no such form field to search by instrument ids
});
}, [
instrumentTypes,
Expand All @@ -62,18 +62,21 @@ export const SidebarFilterWidget = (props: Props) => {
releaseDateFrom,
releaseDateTo,
countries,
materials,
materials
]);

return (
<div className={styles.filter_sidebar}>
<div className={styles.filter__wrapper}>
<InstrumentTypeFilter onValueChange={setInstrumentTypes} />
</div>
<div className={styles.filter__wrapper}>
<ManufacturerNameFilter onValueChange={setManufacturerNames} />
<div className={styles.filter__type_manufacturer__wrapper}>
<div className={styles.filter__wrapper}>
<InstrumentTypeFilter onValueChange={setInstrumentTypes} />
</div>
<div className={styles.filter__wrapper}>
<ManufacturerNameFilter onValueChange={setManufacturerNames} />
</div>
</div>


<div className={styles.filter__wrapper}>
<legend style={{ padding: "0" }}>Manufacture Date</legend>

Expand Down Expand Up @@ -108,12 +111,14 @@ export const SidebarFilterWidget = (props: Props) => {
</div>
</div>

<div className={styles.filter__wrapper}>
<CountryFilter onValueChange={setCountries} />
</div>
<div className={styles.filter__type_manufacturer__wrapper}>
<div className={styles.filter__wrapper}>
<CountryFilter onValueChange={setCountries} />
</div>

<div className={styles.filter__wrapper}>
<MaterialFilter onValueChange={setMaterials} />
<div className={styles.filter__wrapper}>
<MaterialFilter onValueChange={setMaterials} />
</div>
</div>

{Jwt.extractFromCookie()?.toRole() === Role.Editor && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
@use "shared/styles/vars" as vars;

.filter_sidebar {
padding: 0.2em;
background-color: #e0e0e0;
border: 1px #cccccc solid;
}

.filter__wrapper {
flex: 1;
margin-bottom: 0.5em;
}

Expand All @@ -15,3 +18,13 @@
.vertical__wrapper {
display: flex;
}

@media (max-width: vars.$media_threshold) {
.filter__type_manufacturer__wrapper {
display: flex;
}

.filter_sidebar {
//display: none;
}
}
18 changes: 10 additions & 8 deletions client/src/widgets/catalogue-serp/ui/Serp.widget.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import styles from "./styles/Serp.widget.module.css";
import styles from "./styles/Serp.widget.module.scss";
import { InstrumentDetail, InstrumentId } from "generated/model";
import { InstrumentCard } from "shared/instrument-card";

Expand All @@ -17,13 +17,15 @@ export const SerpWidget = (props: Props) => {

{props.instruments.length > 0 &&
props.instruments.map((instrument) => (
<InstrumentCard
key={instrument.instrument_id.instrument_id}
instrument={instrument}
favorite={props.favoriteInstrumentIds
.map((id) => id.instrument_id)
.includes(instrument.instrument_id.instrument_id)}
/>
<div className={styles.serp__instrument_card_wrapper}>
<InstrumentCard
key={instrument.instrument_id.instrument_id}
instrument={instrument}
favorite={props.favoriteInstrumentIds
.map((id) => id.instrument_id)
.includes(instrument.instrument_id.instrument_id)}
/>
</div>
))}
</div>
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@use "shared/styles/vars" as vars;

.serp {
display: flex;
flex-wrap: wrap;
}

.serp__instrument_card_wrapper {
width: 50%;
}

.not_found {
font-size: 2em;
margin: 0.5em;
}

@media (max-width: vars.$media_threshold) {
.serp {
flex-direction: column;
}

.serp__instrument_card_wrapper {
width: 100%;
}
}

0 comments on commit 9f1b6fa

Please sign in to comment.