Skip to content

Commit

Permalink
Merge pull request #35 from NUS-Fintech-Society/task-20-event-tag-des…
Browse files Browse the repository at this point in the history
…ktop

Task 20 event tag desktop
  • Loading branch information
gnimnix authored Mar 19, 2024
2 parents 6c4631d + 8dc15f2 commit bf2d544
Show file tree
Hide file tree
Showing 7 changed files with 610 additions and 555 deletions.
27 changes: 27 additions & 0 deletions src/assets/css/events/EventTag.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.container {
display: flex;
margin: 5px;
padding: 5px;
border-radius: 10px;
}

.container:hover {
cursor: pointer;
}

.font {
font-family: "DM Sans";
font-size: 10px;
font-style: normal;
font-weight: bold;
line-height: normal;
}

.fontBlack {
color: #151515;

}

.fontWhite {
color: #ffffff;
}
10 changes: 10 additions & 0 deletions src/components/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ export const BREAKPOINTS = {
XL: 1200,
XXL: 1400
}

export const EVENT_TAG_COLORS = {
SD: '#528EE8',
ML: '#8BCA80',
BC: '#EA5959',
Q: '#C179B9',
IA: '#7DCACF',
ER: '#FDCE55',
PC: '#0C1747',
}
29 changes: 29 additions & 0 deletions src/components/events/EventTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styles from "css/events/EventTag.module.css";
import { EVENT_TAG_COLORS } from "../constants";

interface EventTagProps {
name: string;
datetime: Date;
backgroundColor: string;
}

const EventTag = ({
name,
backgroundColor,
}: EventTagProps) => {
return (
<div className={`${styles.container} ${styles.font}`} style={{ backgroundColor }}>
<span
className={
backgroundColor == EVENT_TAG_COLORS.PC
? styles.fontWhite
: styles.fontBlack
}
>
{name}
</span>
</div>
);
};

export default EventTag;
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ enableMocking().then(() => {
</QueryClientProvider>
</React.StrictMode>,
)
})
})
18 changes: 18 additions & 0 deletions src/routes/events/EventPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { EVENT_TAG_COLORS } from "@/components/constants";
import EventTag from "@/components/events/EventTag";

function EventPage() {
return (
<>
<EventTag name={'Event Test 1 - Software Development'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.SD} />
<EventTag name={'Event Test 2 - Machine Learning'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.ML} />
<EventTag name={'Event Test 3 - Blockchain'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.BC} />
<EventTag name={'Event Test 4 - Quant'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.Q} />
<EventTag name={'Event Test 5 - Internal Affairs'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.IA} />
<EventTag name={'Event Test 6 - External Relations'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.ER} />
<EventTag name={'Event Test 7 - Presidential Cell'} datetime={new Date()} backgroundColor={EVENT_TAG_COLORS.PC} />
</>
)
}

export default EventPage
5 changes: 5 additions & 0 deletions src/routes/router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createBrowserRouter } from "react-router-dom";
import TestPage from "./shared/TestPage.tsx";
import App from "./App.tsx"
import EventPage from "./events/EventPage.tsx";


const router = createBrowserRouter([
Expand All @@ -11,6 +12,10 @@ const router = createBrowserRouter([
{
path: "/test",
Component: TestPage,
},
{
path: "/events",
Component: EventPage,
}
])

Expand Down
Loading

0 comments on commit bf2d544

Please sign in to comment.