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

[IMPROVE] refactor hard-coded component data into parameters (react component props) #145

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
79 changes: 3 additions & 76 deletions app/components/discourserankedlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,81 +28,8 @@ function TimeSince(date) {
return Math.floor(seconds) + ' seconds ago';
}

function Discourserankedlist(props) {
const Data = [
{
id: 1,
title:
'Upload stuck at 0% again after initially fixing with chanding site url in General admin options',
time: '6:57 PM',
upvotes: '89',
comments: '91',
},
{
id: 2,
title: 'Why can’t we have thumbnails for video uploads on mobile?',
time: '4:00 PM',
upvotes: '500',
comments: '4',
},
{
id: 3,
title: 'Can’t find “Users must use Two Factor Authentication” Option',
time: '12:53 PM',
upvotes: '456',
comments: '75',
},
{
id: 4,
title: 'Can’t “forget/remove my data” directly in RC 4.3.0 in livechat',
time: '8:36 AM',
upvotes: '234',
comments: '199',
},
{
id: 5,
title: 'Not migrating, control is locked',
time: '11:30 PM',
upvotes: '441',
comments: '74',
},
{
id: 6,
title:
'Upload stuck at 0% again after initially fixing with chanding site url in General admin options',
time: '7:14 PM',
upvotes: '972',
comments: '42',
},
{
id: 7,
title: 'Can’t find “Users must use Two Factor Authentication” Option',
time: '3:36 PM',
upvotes: '4279',
comments: '98',
},
{
id: 8,
title: 'Cannot Chat Log Level - Option has disappeared',
time: '11:06 AM',
upvotes: '51',
comments: '291',
},
{
id: 9,
title: 'Wrong IP Server',
time: '2:00 PM',
upvotes: '478',
comments: '25',
},
{
id: 10,
title: 'Not migrating, control is locked',
time: '11:03 PM',
upvotes: '16',
comments: '15',
},
];
function Discourserankedlist({activities}) {

//generates random colour for border styling
const color = [
'border-primary',
Expand Down Expand Up @@ -130,7 +57,7 @@ function Discourserankedlist(props) {
<Col
className={`${styles.container} d-flex flex-wrap justify-content-center`}
>
{Data.map(item => (
{activities.map(item => (
<Col
key={item.id}
href={item.link}
Expand Down
52 changes: 22 additions & 30 deletions app/components/growthcounters.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
import styles from '../styles/Growthcounters.module.css';
import Countup from './clientsideonly/countup';
import styles from "../styles/Growthcounters.module.css";
import Countup from "./clientsideonly/countup";
export default function Growthcounters({ counters }) {


export default function Growthcounters() {
return (
<>
<div className=' d-flex flex-row align-items-center justify-content-center '>
<div className='d-flex flex-column pe-4 px-md-5 mx-md-3'>
<span suppressHydrationWarning={true}>
{process.browser && (
<Countup end={343433} className={` ${styles.countup}`} />
)}
</span>

<span className={` ${styles.text}`}>Users</span>
</div>

<div className='d-flex flex-column px-4 px-md-5 mx-md-3 border-start border-gray'>
<span suppressHydrationWarning={true}>
{process.browser && (
<Countup end={1294056} className={` ${styles.countup}`} />
)}
</span>
<span className={` ${styles.text}`}>Messages</span>
</div>
<div className=" d-flex flex-row align-items-center justify-content-center ">
{counters.map((count, index) => {
return (
<div
className={
"d-flex flex-column pe-4 px-md-5 mx-md-3 " +
(index != 0 ? "border-start border-gray" : "")
}
>
<span suppressHydrationWarning={true}>
{process.browser && (
<Countup end={count.count} className={` ${styles.countup}`} />
)}
</span>

<div className='d-flex flex-column ps-4 px-md-5 mx-md-3 border-start border-gray'>
<span suppressHydrationWarning={true}>
{process.browser && (
<Countup end={507} className={` ${styles.countup}`} />
)}
</span>
<span className={` ${styles.text}`}>Online</span>
</div>
<span className={` ${styles.text}`}>{count.title}</span>
</div>
);
})}
</div>
</>
);
Expand Down
9 changes: 5 additions & 4 deletions app/components/infotiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import Image from "next/image";
import Link from "next/link";
import Styles from "../styles/Infotiles.module.css";

export default function Infotiles({ data }) {
export default function Infotiles(props) {

return (
<>
{data.map((obj) => (
{props?.infotiles?.map((obj) => (
<div
key={obj.id}
className={obj.imageUrl ? Styles.cardWithImage : Styles.card}
Expand All @@ -19,9 +20,9 @@ export default function Infotiles({ data }) {
/>
)}
<div className={Styles.card_content}>
<h5 className={Styles.card_heading}>{obj.name}</h5>
<h5 className={Styles.card_heading}>{obj.title}</h5>
{obj.bio && <p className="fs-light">{obj.bio}</p>}
<p className={Styles.card_body}>{obj.content}</p>
<p className={Styles.card_body}>{obj.description}</p>
{obj.live && <Link href={obj.confHref}><button className={Styles.actionBtn}>Live</button></Link>}
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion app/components/newscarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ function Newscarousel(props) {
},
},
{
breakpoint: 600,
breakpoint: 800,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
initialSlide: 2,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 2,
initialSlide: 2,
},
},
]}
prevArrow={
<svg
Expand Down
145 changes: 0 additions & 145 deletions app/components/personalcircle.js

This file was deleted.

33 changes: 33 additions & 0 deletions app/components/personcircle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Col } from "react-bootstrap";
import styles from "../styles/Personacircle.module.css";
import dynamic from 'next/dynamic'
import React from "react";


const fetchIcon=(iconName)=>{
let Icon = dynamic(() => import('react-icons/fa').then(icons => icons[iconName]));
return <Icon className={styles.icon} />;
}

export default function Personcircle({persons}) {
return (
<>
<Col
className={`${styles.personas} d-flex flex-wrap justify-content-center`}
>
{persons.map((person) => {
return (
<span className={`${styles.persona}`}>
<div className={styles.svg}>

{ fetchIcon(person?.persona_icon?.icon) }

</div>
<div className={styles.title}>{person.name}</div>
</span>
);
})}
</Col>
</>
);
}
Loading