Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description container #213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1027a22
feat: add Yedidya Rashi profile (#220)
Yedidyar Jun 24, 2022
554b82d
chore: remove idea folder (#236)
OmriBarZik Jul 2, 2022
5e9ea19
updating readme: custom image (#239)
shir22 Jul 2, 2022
365afa6
test: add e2e infra with playwright and a sample test (#235)
lirantal Jul 2, 2022
b452576
Yedidyar/issue167 (#240)
Yedidyar Jul 2, 2022
d7e85d9
fix(Description): wrap descriptionHeight with useEffect (#243)
Yedidyar Jul 2, 2022
44dd239
Merge branch 'master' of https://github.com/Pull-Request-Community/pu…
Yedidyar Jul 4, 2022
70aaa86
There is no background for the role of Former admin label
Yedidyar Jul 4, 2022
453f762
Merge pull request #250 from Yedidyar/Yedidyar/issue241
InbarDanieli Jul 4, 2022
6b90aa7
Test (#238)
Noamili Jun 28, 2022
d9dc2f7
Merge branch 'Pull-Request-Community:staging' into staging
Noamili Jul 8, 2022
69caacd
Merge branch 'Pull-Request-Community:staging' into staging
Noamili Jul 10, 2022
d511a18
rename container component
noamilsh Jun 17, 2022
6ce8d9e
update description style in layout
noamilsh Jun 17, 2022
b348709
clean ups
noamilsh Jun 17, 2022
ea6a4a7
fix race condition between layout and description
noamilsh Jun 18, 2022
93cd58c
style fixes
noamilsh Jun 19, 2022
58f2d1f
revert style fixes in grid
noamilsh Jun 19, 2022
e2d9f5a
remove top
noamilsh Jun 28, 2022
94abebd
style fix
noamilsh Jul 3, 2022
5e7bd51
fix conflict
noamilsh Jul 3, 2022
c12e594
fix conflict
noamilsh Jul 3, 2022
2117144
fix style
noamilsh Jul 8, 2022
1657f59
rename descriptionText
noamilsh Jul 8, 2022
b9dd20b
fix conflict
noamilsh Jul 10, 2022
096d98b
fix style
noamilsh Jul 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions components/description/description.module.scss

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.container {
display: flex;
justify-content: center;
background-color: var(--background-description);
box-shadow: 0 0 10px 5px rgb(0, 0, 0, 0.2);
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { useEffect, useRef, useState } from 'react';
import style from './description.module.scss';
import colors from '../../styles/colors';
import style from './DescriptionContainer.module.scss';

const Description = ({ descriptionOutput, descriptionHeight }) => {
const DescriptionContainer = (props) => {
const { children, descriptionHeight } = props;
const myRef = useRef(null);
const [height, setHeight] = useState(0);

useEffect(() => {
descriptionHeight(height);
}, [descriptionHeight, height]);
}, [height]);

useEffect(() => {
const handleResize = () => {
Expand All @@ -23,9 +23,9 @@ const Description = ({ descriptionOutput, descriptionHeight }) => {

return (
<div ref={myRef} id="container" className={style.container}>
{descriptionOutput}
{children}
</div>
);
};

export default Description;
export default DescriptionContainer;
20 changes: 20 additions & 0 deletions components/layout/layout.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.description {
height: max-content;
display: flex;
flex-direction: column;
font-size: 1rem; // Based on 16px.
gap: 20px;
padding: 136px 0 114px;
margin: 0 auto;
width: 1280px;

@media only screen and (max-width: 1280px) {
Noamili marked this conversation as resolved.
Show resolved Hide resolved
padding: 136px 24px 114px;
}

@media only screen and (max-width: 768px) {
Noamili marked this conversation as resolved.
Show resolved Hide resolved
padding: 136px 24px 80px;
margin: 0 auto;
max-width: 1280px;
}
}
20 changes: 11 additions & 9 deletions components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import Head from 'next/head';
import { getMetaData } from '../../services/metaData';
import Navbar from './navbar/navbar';
import Footer from './footer/footer';
import Description from '../description/Description';
import { useState } from 'react';
import DescriptionContainer from '../descriptionContainer/DescriptionContainer';
import style from './layout.module.scss';

const Layout = ({ children, descriptionText }: LayoutProps) => {
const Layout = ({ children, descriptionContent }: LayoutProps) => {
const currentRoute = useRouter().pathname;
const { title, metaContents } = getMetaData(currentRoute);
const [currentHeight, setCurrentHeight] = useState(0);

return (
<div>
<>
<Head>
<link rel="icon" href="/favicon.png" />
<meta property="image" content="/images/logo.png" />
Expand All @@ -22,21 +23,22 @@ const Layout = ({ children, descriptionText }: LayoutProps) => {
{metaContents && metaContents.map((meta, i) => <meta key={i} {...meta} />)}
</Head>
<Navbar DesHeight={currentHeight} />
<Description
descriptionOutput={descriptionText}
<DescriptionContainer
descriptionHeight={(hight) => {
setCurrentHeight(hight);
}}
/>
<div className="layout__container layout__body--container">{children}</div>
>
<div className={style.description}>{descriptionContent}</div>
</DescriptionContainer>
{children}
<Footer />
</div>
</>
);
};

interface LayoutProps {
children: object;
descriptionText?: object;
descriptionContent?: object;
}

export default Layout;
5 changes: 1 addition & 4 deletions pages/articles.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { GetStaticProps } from 'next';
import Description from '../components/description/Description';
import Layout from '../components/layout/layout';
import { PersonCard } from '../components/personCard/personCard';
import { getPeople, IPerson } from '../services/people';
import styles from '../styles/Home.module.scss';
import { randomShuffle } from '../utils/randomShuffle';
interface IHomeProps {
people: IPerson[];
Expand All @@ -12,7 +9,7 @@ interface IHomeProps {
export default function Articles({ people }: IHomeProps) {
return (
<Layout>
<div className={styles.container}>Scafolding for article page</div>
<div>Scafolding for article page</div>
</Layout>
);
}
Expand Down
12 changes: 7 additions & 5 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ interface IHomeProps {

export default function Home({ people }: IHomeProps) {
return (
<Layout descriptionText={MainPageDescription()}>
<div className={styles.cards__wrapper}>
{people.map((person, i) => (
<PersonCard key={person.name + i} person={person} />
))}
<Layout descriptionContent={<MainPageDescription/>}>
<div className={styles.container}>
<div className={styles.cards__wrapper}>
{people.map((person, i) => (
<PersonCard key={person.name + i} person={person} />
))}
</div>
</div>
</Layout>
);
Expand Down
3 changes: 1 addition & 2 deletions pages/projects.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import next from 'next';
import React, { useState } from 'react';
import Description from '../components/description/Description';
import Navbar from '../components/layout/navbar/navbar';
import style from '../styles/projects.module.scss';
import ProjectPage from '../components/projectPage/projectPage';
Expand All @@ -12,7 +11,7 @@ export default function Vast() {
console.log(currentHeight);

return (
<Layout descriptionText={ProjectPage()}>
<Layout descriptionContent={<ProjectPage/>}>
<h1>projects</h1>
</Layout>
);
Expand Down