Skip to content

Commit

Permalink
Merge pull request #154 from skni-kod/issue-153
Browse files Browse the repository at this point in the history
Issue 153
  • Loading branch information
pablitoo1 authored Dec 11, 2024
2 parents 845f7aa + 1a73916 commit 93c1324
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ResultCount = ({ value }: { value: number | undefined }) => {
return (
<div>
Znaleziono <span className="text-sky-500">{value ? value : 0}</span> elementów
Znalezione elementy: <span className="text-sky-500">{value ? value : 0}</span>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/PageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface PageProps extends ComponentParentProps {

export default function PageContent({ headerValue, noHeader = false, noContainer = false, children }: PageProps) {
const contentClasses = `text-secondary ${noHeader ? '' : ' pt-2'}`;
const headerClasses = `text-secondary text-semibold w-full text-4xl${noHeader ? '' : ' pb-8'}`;
const headerClasses = `text-secondary text-semibold w-full text-2xl xs:text-4xl ${noHeader ? '' : ' pb-8'}`;

return (
<Container clear={noContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function AddGradeMaterialModal({
return (
<>
{isOpen && (
<Modal onClose={handleClose} className="max-w-xs xs:w-full">
<Modal onClose={handleClose} className="h-fit w-[90%] sm:w-2/3">
<div className="w-full text-center">
<h3 className="text-3xl font-semibold text-secondary">{getModalHeader()}</h3>
</div>
Expand Down
11 changes: 10 additions & 1 deletion src/components/materials/add_grade_modal/stages/AddGrade.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
'use client';
import React from 'react';
import { Rating } from 'react-simple-star-rating';
import useMediaQuery from '@mui/material/useMediaQuery';

export default function AddGrade({ rating, onChange }: { rating: number; onChange: (rating: number) => void }) {
const rwd = useMediaQuery('(min-width:400px)');

const handleRatingClick = (rate: number) => {
onChange(rate);
};

return (
<div className="flex w-full flex-col gap-4">
<div className="flex items-center justify-center">
<Rating initialValue={rating} SVGstyle={{ display: 'inline' }} size={72} onClick={handleRatingClick} />
<Rating
initialValue={rating}
SVGstyle={{ display: 'inline' }}
size={rwd ? 72 : 52}
onClick={handleRatingClick}
/>
</div>

<div className="text-center text-secondary">{rating > 0 && `Wybrana ocena: ${rating}`}</div>
Expand Down
13 changes: 1 addition & 12 deletions src/components/materials/add_modal/AddMaterialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@ export default function AddMaterialModal({ isOpen, onClose }: { isOpen: boolean;
}
};

const getModalSize = () => {
switch (stage) {
case Stage.SECTION:
return 'w-128';
case Stage.CATEGORY:
case Stage.DETAILS:
case Stage.SUMMARY:
return 'w-full';
}
};

const getModalHeader = () => {
switch (stage) {
case Stage.SECTION:
Expand Down Expand Up @@ -184,7 +173,7 @@ export default function AddMaterialModal({ isOpen, onClose }: { isOpen: boolean;
return (
<>
{isOpen && (
<Modal onClose={handleClose} className={`${getModalSize()} max-w-xs xs:w-full`}>
<Modal onClose={handleClose} className="h-fit w-[90%] sm:w-2/3">
{status === Status.ERROR || !sections ? (
<Error />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function MaterialResultsDisplay({
searchParams,
DetailsDropDownComponent,
}: MaterialResultsDisplayProps) {
console.log('searchParams1111111', searchParams);
const { data: materials, status, fetch: fetchMaterials } = useFetchState<Pageable<MaterialSearch>>();

useEffect(() => {
Expand All @@ -49,9 +48,9 @@ export default function MaterialResultsDisplay({

return (
<div className="py-2">
<div className="flex w-full items-center justify-between px-4 pt-5">
<div className="flex w-full flex-col items-center justify-between gap-y-4 px-0 pt-5 md:flex-row md:gap-y-0 md:px-4">
<SortOrderBtn activeSort={searchParams.sort} />
<ResultCount value={materials.content.length} />
{materials.content.length > 0 && <ResultCount value={materials.content.length} />}
</div>
<MaterialListBlock materials={materials.content} DetailsDropDownComponentProp={DetailsDropDownComponent} />
<div className="flex w-full justify-center pt-6">
Expand Down
8 changes: 4 additions & 4 deletions src/components/materials/common/page_head/FiltersBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ type FiltersBlockProps = ComponentParentProps & {
};

export default function FiltersBlock({ searchParams }: FiltersBlockProps) {
const FILTER_FIELD_CLASSNAMES = 'flex items-center gap-2.5 p-2.5 border-2 rounded-2xl overflow-hidden';
const FILTER_FIELD_CLASSNAMES = 'flex items-center gap-2.5 p-2.5 border-2 rounded-2xl overflow-hidden w-fit';

return (
<div className="w-full px-4 pt-6">
<h3 className="w-full pb-5 text-2xl">{TEXT.WHAT_LOOKING_FOR}</h3>
<div className="flex w-full flex-wrap gap-2 leading-none">
<div className="w-full px-0 pt-6 sm:px-4">
<h3 className="w-full pb-5 text-xl sm:text-2xl">{TEXT.WHAT_LOOKING_FOR}</h3>
<div className="flex w-full flex-wrap gap-2 text-sm leading-none xs:text-base">
<PhraseField className={FILTER_FIELD_CLASSNAMES} activePhrase={searchParams.fields.phrase} />
<MaterialSort className={FILTER_FIELD_CLASSNAMES} activeSort={searchParams.sort} />
<GradeField
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use client';
import React, { useState } from 'react';
import { LuDot } from 'react-icons/lu';
import { Rating } from 'react-simple-star-rating';
import { useMediaQuery } from '@mui/material';
import Image from 'next/image';

import calculateTimeDifference from '../../../../utils/methods/calculateTimeDifference';
Expand All @@ -15,6 +17,7 @@ type MaterialUserBlockProps = {

export default function MaterialListItem({ data: material, children }: MaterialUserBlockProps) {
const [isOpenDetails, setIsOpenDetails] = useState<boolean>(false);
const rwdXS = useMediaQuery('(min-width:530px)');

const handleOpenDetails = () => {
setIsOpenDetails((prevState) => !prevState);
Expand All @@ -36,16 +39,24 @@ export default function MaterialListItem({ data: material, children }: MaterialU
readonly
/>
</div>
<div className="">{calculateTimeDifference(material.createdDate.toString())}</div>
<div className="text-xs 2xs:text-sm xs:text-base">
{calculateTimeDifference(material.createdDate.toString())}
</div>
</div>
<div className="flex w-full justify-between gap-6 py-3">
<div>
<Image src={DocumentsImage.src} alt="Materiał Kodemy" className="aspect-square" width="65" height="65" />
<Image
src={DocumentsImage.src}
alt="Materiał Kodemy"
className="aspect-square"
width={rwdXS ? '65' : '50'}
height={rwdXS ? '65' : '50'}
/>
</div>
<div className="flex-1">
<h3 className="text-lg font-semibold text-primary">{material.title}</h3>
<div className="pt-1">{material.author?.username}</div>
<div className="flex items-center pt-1.5">
<h3 className="text-sm font-semibold text-primary 2xs:text-base xs:text-lg">{material.title}</h3>
<div className="pt-1 text-xs 2xs:text-sm xs:text-base">{material.author?.username}</div>
<div className="flex items-center pt-1.5 text-xs 2xs:text-sm xs:text-base">
{material.tags.map(({ name }, index) => (
<React.Fragment key={index}>
<span>{name}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function CategoryBubbleBtns({ sections, activeSectionId, activesC
};

return (
<div className="flex w-full flex-wrap items-center gap-4 text-center text-xl text-secondary">
<div className="flex w-full flex-wrap items-center gap-2 text-center text-sm text-secondary xs:gap-4 xs:text-xl">
{sectionCategories().map(({ id, name }) => (
<CategoryBubbleBtn
key={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function PhraseField({ className, activePhrase }: PhraseFieldProp
<div className={className}>
<input
placeholder={TEXT.INPUT_PHRASE}
className="border-0 bg-transparent focus:outline-none"
className="w-32 border-0 bg-transparent focus:outline-none xs:w-40"
value={phrase}
name="phrase"
onChange={(e) => setPhrase(e.target.value)}
Expand Down
1 change: 0 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable prettier/prettier */
import type { Config } from 'tailwindcss';

const config: Config = {
Expand Down

0 comments on commit 93c1324

Please sign in to comment.