Archived
list
This commit is contained in:
1 parent
eb0b4f0e4c
commit
f262990197
4 files changed
+54
-12
No files matched your search
@@ -1,16 +1,36 @@
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { BIcon } from "../BIcon";
|
import { BIcon } from "../BIcon";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import {orangeColor} from "../../index.scss";
|
||||||
export const EventPreview = (props) => {
|
export const EventPreview = (props) => {
|
||||||
return (
|
const [label, setLabel] = useState("");
|
||||||
<Link to={`/event/${props.id}`} className={styles.link}>
|
const [color, setColor] = useState("white");
|
||||||
<div className={styles.item}>
|
useEffect(() => {
|
||||||
<span className={styles.location}>{props.name ?? "Event name"}</span> <br></br>
|
console.log(orangeColor) //nie działa :((
|
||||||
<span>
|
switch (props.type) {
|
||||||
<BIcon icon="calendar" /> {props.date ?? ""}
|
case 1:
|
||||||
</span>
|
setColor("green");
|
||||||
</div>
|
break;
|
||||||
</Link>
|
case 2:
|
||||||
);
|
setColor("red");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}, [label,color,props.type]);
|
||||||
|
return (
|
||||||
|
<Link to={`/event/${props.id}`} className={styles.link}>
|
||||||
|
<div className={styles.item}>
|
||||||
|
<span className={styles.location}>{props.name ?? "Event name"}</span>{" "}
|
||||||
|
<br></br>
|
||||||
|
<span className={styles.time}>
|
||||||
|
<BIcon icon="calendar" /> {props.date ?? ""}
|
||||||
|
</span>{" "}
|
||||||
|
<br></br>
|
||||||
|
<div style={{ background: color }} className={styles.block}>
|
||||||
|
{label}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
@@ -25,3 +25,15 @@
|
|||||||
font-size: 1.7em;
|
font-size: 1.7em;
|
||||||
transition: color 0.2s ease;
|
transition: color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
.time{
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
.block{
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.8em;
|
||||||
|
max-width:120px;
|
||||||
|
padding:3px;
|
||||||
|
height:25px;
|
||||||
|
border-radius:10px;
|
||||||
|
}
|
||||||
@@ -5,8 +5,18 @@ $gray: #dadada;
|
|||||||
$bggray: #e8e8e8;
|
$bggray: #e8e8e8;
|
||||||
$bghover: darken($bggray, 10);
|
$bghover: darken($bggray, 10);
|
||||||
$bg: #ffffff;
|
$bg: #ffffff;
|
||||||
|
$orange:#FBBEBE;
|
||||||
$defaultWidth: 90vw;
|
$defaultWidth: 90vw;
|
||||||
$maxWidth: 650px;
|
$maxWidth: 650px;
|
||||||
|
$theme-colors: (
|
||||||
|
'orangeColor': #FBBEBE,
|
||||||
|
'anotherColor': #FFF,
|
||||||
|
);
|
||||||
|
:export {
|
||||||
|
@each $key, $value in $theme-colors {
|
||||||
|
#{unquote($key)}: $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export const Home = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
{list.map((e, i) => {
|
{list.map((e, i) => {
|
||||||
return <EventPreview name={e.name} date={e.date} id={e._id} key={i} />;
|
return <EventPreview name={e.name} type={e.type} date={e.date} id={e._id} key={i} />;
|
||||||
})}
|
})}
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user