Git Product home page Git Product logo

Comments (16)

AMartindale98 avatar AMartindale98 commented on June 11, 2024 1

Thanks, this one works!

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98, can you please share the code for your timeline component, as well as a link to a CodeSandbox where it can be reproduced?

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

Hi there. I'm using Vite not CRA. Here is the code below:

function Timeline() {
  const timelineItems = [
    {
      title: "2016",
      cardTitle: "First year",
      cardSubtitle: "",
      cardDetailedText:
        "Our first year doing Extra Life as a team with just 10 players.",
      media: {
        name: "2016 team",
        source: {
          url: "https://i.imgur.com/KvhN54a.jpg",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2017",
      cardTitle: "Second year",
      cardSubtitle: "",
      cardDetailedText:
        "Our second year was similarly small, but we set the bar higher and raised more money than the year before.",
      media: {
        name: "2017 team",
        source: {
          url: "https://i.imgur.com/I1Yp4SD.png",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2018",
      cardTitle: "Third year",
      cardSubtitle: "",
      cardDetailedText:
        "This year was special, as it was the first year that we had more than a handful of players. We also moved our location to West Chester University.",
      media: {
        name: "2018 team",
        source: {
          url: "https://i.imgur.com/ANVrru8.png",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2019",
      cardTitle: "Fourth year",
      cardSubtitle: "",
      cardDetailedText:
        "In 2019, we became an official WCU service organization, allowing us access to even more resources to make it the best year yet. Pictured here are our captains, but our team grew in size once again. We also piloted a high school team, partnering with a local school to provide guidance and support to a group of high schoolers.",
      media: {
        name: "2019 team",
        source: {
          url: "https://i.imgur.com/JK9lBCW.jpg",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2020",
      cardTitle: "Fifth year",
      cardSubtitle: "",
      cardDetailedText:
        "Despite the challenges of the pandemic, we launched our first alumni team this year, pictured here.",
      media: {
        name: "2020 team",
        source: {
          url: "https://i.imgur.com/KRVACf5.jpg",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2021",
      cardTitle: "Sixth year",
      cardSubtitle: "",
      cardDetailedText:
        "Due to the continued pandemic, we piloted a fully remote team. We utilized Discord to stay connected and encourage each other throughout the event.",
      media: {
        name: "2021 team",
        source: {
          url: "https://i.imgur.com/O8xy0yL.jpg",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2022",
      cardTitle: "Seventh year",
      cardSubtitle: "",
      cardDetailedText:
        "In 2022, we decided to host a hybrid event. Volunteers hosted hubs at their homes, while other players chose to play solo. We hosted a second event at a local gaming studio, Uplink Studios. We were also invited to speak at a 'Best Practices' panel at Extra Life United for our successful collegiate model. Pictured here is our panel.",
      media: {
        name: "2022 panel",
        source: {
          url: "https://i.imgur.com/aRAfrkU.jpg",
        },
        type: "IMAGE",
      },
    },
    {
      title: "2023",
      cardTitle: "Eighth year",
      cardSubtitle: "",
      cardDetailedText:
        "In 2023, we hosted an in-person event at Uplink Studios, with continued hybrid options for players who are no longer local to the area or simply prefer to play solo. We have plans for a secondary event for folks who were not able to play on our Game Day. ",
      media: {
        name: "2023 team",
        source: {
          url: "https://i.imgur.com/3dkUbsu.jpg",
        },
        type: "IMAGE",
      },
    },
  ];

  return (
    <div className="w-full h-full">
      <Chrono
        items={timelineItems}
        mediaWidth={300}
        cardWidth={300}
        enableBreakPoint
        verticalBreakPoint={500}
        scrollable={{ scrollbar: false }}
        mode="VERTICAL_ALTERNATING"
        theme={{
          primary: "var(--brand-blue)",
        }}
      />
    </div>
  );
}

export default Timeline;

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 can you clarify what you are trying to achieve scrollable={{ scrollbar: false }} hides/removes the scrollbar.

Also you cant pass css vars directly to the timeline component. you need to pass the hexcode or rgb.

 theme={{
          primary: "#eee",
 }}

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

That was old code I hadn't taken off. The problem I have with scrolling is that it doesn't auto scroll when I click on each item. I tried adjusting a bunch of props and nothing was working. I attempted to set 'disableAutoScrollOnClick' to false but that did not work. Thanks for your help on the theme colors, that worked for me!

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 the auto scroll does seem to be not working. let me check and see if this can be quickly fixed.

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 the auto scroll seems to be having a problem right now only when the timeline points are disabled via the disableTimelinePoint prop. with the setup you have the auto scroll should be working alright.

can you confirm if you are not using the disableTimelinePoint prop?

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

the autoscroll is fixed to also work when disableTimelinePoint is used. closing this for now, reopen if you are still having issues with it

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

Hi, it's still not working for me.

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 looks like you have disableTimelinePoint enabled or something is wrong with how you have setup the timeline. can you share the complete project on codesandbox or point me to your repo?

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

Here's the codesandbox for this component:
https://codesandbox.io/s/young-night-5yjx92

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

thanks @AMartindale98 are you using tailwind in your project?

here is the version that i forked and modified, where the auto scroll works. fix is i removed the custom class name h-full and used a absolute height

https://codesandbox.io/s/blissful-blackwell-gnt6x6?file=/src/App.js

i suspect the auto scroll is failing when you tailwind classes such as h-full. this need to be investigated further and i will check it myself.

let me know if the work around is sufficient for now.

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

No, unfortunately that doesn't work in my project, I guess maybe because I'm using Tailwind throughout the entire project. The timeline is embedded in a larger page that heavily utilizes Tailwind.

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 quick question is the timeline takes up the whole page? why its h-full? ideally the timeline should be rendered inside a container that should have a height and width for it to work. this is a basic requirement for the timeline to function.

from react-chrono.

AMartindale98 avatar AMartindale98 commented on June 11, 2024

I've been playing around with quite a few dimensions, this was just the most recent one. I wanted the timeline to be fully visible on the web page. I've tried a lot of different dimensions and the autoscroll only seems to work when the timeline is cut off in a small container. If it's not possible to have a large container where the timeline can be fully visible, please let me know.

from react-chrono.

prabhuignoto avatar prabhuignoto commented on June 11, 2024

@AMartindale98 have you tried something like this

<div style={{ width: "100%", height: "95vh", border: "1px solid red" }}>
      <Chrono
        items={timelineItems}
        mediaWidth={300}
        cardWidth={300}
        enableBreakPoint
        verticalBreakPoint={500}
        mode="VERTICAL_ALTERNATING"
        theme={{
          primary: "blue",
          titleColor: "#8dd0f1",
          secondary: "#fbbf24"
        }}
      />
 </div>

please note this is just a work around to have the control rendered and take up the available height. i have updated the code here

https://codesandbox.io/s/blissful-blackwell-gnt6x6?file=/src/App.js

further investigation is needed on tailwind interopability

from react-chrono.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.