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

Implement carousel with basic functionality #74

Merged
merged 12 commits into from May 24, 2022
Merged

Implement carousel with basic functionality #74

merged 12 commits into from May 24, 2022

Conversation

slargman
Copy link
Contributor

@slargman slargman commented May 23, 2022

Adds a basic carousel for use across the app. Currently takes two props:

  1. items: an array of the items that the carousel should scroll across
  2. size: the number of items that the carousel should display on the screen

Still to be implemented is the styling as well as a third prop direction which will dictate whether the carousel should be arranged in a row or a column.

Another improvement would be hiding the increment/decrement buttons at end of range states.

@slargman slargman added the implementation task Individual implementation tasks have to be amply do-able, including dev-testing, in a single day. label May 23, 2022
@slargman slargman added this to In progress in Serum board via automation May 23, 2022
@slargman slargman added this to In progress in Overview via automation May 23, 2022
@slargman slargman added this to the Sprint 2 milestone May 23, 2022
Copy link
Contributor

@zman811 zman811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I really like how you did the increment and decrement methods. the only question I had is did you try putting it on the page/testing it and making sure it works there? I didn't see you render it anywhere in the code you changed here or have any tests

@slargman
Copy link
Contributor Author

I did put it on the page and make sure that it works as expected. I haven't written tests for it yet, but I probably should. I'm wrapping up the basic functionality on another component and then I'll come back to add those. We can let these PRs sit until they have at least one test added.

@zman811
Copy link
Contributor

zman811 commented May 23, 2022

sweet sounds good, no rush.

@slargman slargman marked this pull request as draft May 23, 2022 16:15
@slargman slargman marked this pull request as ready for review May 24, 2022 00:25
@slargman slargman requested a review from rlargman May 24, 2022 00:25
Copy link
Collaborator

@rlargman rlargman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Not sure in which cases you'll need to show multiple items at once in the carousel, but all functionality and tests seem good, only some minor style nits that can be ignored if you want

import React from 'react';
import '@testing-library/jest-dom/extend-expect';
import { fireEvent, render, screen } from '@testing-library/react';
// import userEvent from '@testing-library/user-event';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unused. This doesn't really matter, but might want to put in a lint rule to prevent unused imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My linter is already screaming at me over so many things :(. I do have an unused imports rule, might've just ignored it. Which import can I remove? The one on line 4?

import React, { useState } from "react";
import PropTypes from "prop-types";

function Carousel({ items, size }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some good general style conventions, put a comment on public exports. Carousel is pretty self explanatory, but could be nice for more complicated ones, and in general for the props that are being passed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Added some documentation. The Carousel is shared across the app, but would you suggest documentation on components that only I will be using too?

@slargman
Copy link
Contributor Author

Looks pretty good. Not sure in which cases you'll need to show multiple items at once in the carousel, but all functionality and tests seem good, only some minor style nits that can be ignored if you want

Btw displaying more than one item is for a use case like this:
image

@slargman slargman merged commit 79cd2bd into main May 24, 2022
@slargman slargman deleted the carousel branch May 24, 2022 01:49
Serum board automation moved this from In progress to Deployed to production May 24, 2022
Overview automation moved this from In progress to Done May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
implementation task Individual implementation tasks have to be amply do-able, including dev-testing, in a single day.
Projects
Serum board
Deployed to production
Development

Successfully merging this pull request may close these issues.

None yet

3 participants