cornellh4i / ithaca-recovery

Ithaca Community Recovery Event and Meeting Setup Automation Tool
https://ithaca-recovery.vercel.app
8 stars 3 forks source link

Daily Calendar View (frontend) #66

Open owenchen04 opened 5 days ago

owenchen04 commented 5 days ago

branch name: daily-calendar-view

Hi Brandon and Tanvi! On this ticket, we're going to start putting together some of our previously completed components and implement the frontend for the daily calendar view (for now, only focus on the daily view. Do not worry about monthly or weekly). Here is the design from the Figma page:

Image

Task:

import React from 'react';

function TimeBasedComponent({ time, children }) {
  // Define a constant for pixels per unit of "time" (customize as needed)
  const pixelsPerTimeUnit = 10;
  // Calculate the offset based on the "time" prop
  const offset = time * pixelsPerTimeUnit;

  return (
    <div
      style={{
        transform: `translateX(${offset}px)`,
        transition: 'transform 0.3s ease', // Optional: smooth transition when time changes
      }}
    >
      {children}
    </div>
  );
}

export default function App() {
  return (
    <div style={{ display: 'flex', overflow: 'hidden' }}> {/* Horizontal row */}
      <TimeBasedComponent time={1}>Component 1</TimeBasedComponent>
      <TimeBasedComponent time={2}>Component 2</TimeBasedComponent>
      <TimeBasedComponent time={3}>Component 3</TimeBasedComponent>
    </div>
  );
}

Testing: