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

Render children for QuestionBox #224

Open
7 tasks done
justin-b-yee opened this issue Oct 7, 2024 · 8 comments · May be fixed by #294
Open
7 tasks done

Render children for QuestionBox #224

justin-b-yee opened this issue Oct 7, 2024 · 8 comments · May be fixed by #294
Assignees
Labels

Comments

@justin-b-yee
Copy link
Contributor

justin-b-yee commented Oct 7, 2024

Specs

<QuestionBox 
    children = [].
    // other props
/>

Refactor app/components/question-box.jsx so that it renders children, rather than just rendering a status badge with the number of participants. Where QuestionBox is used in the code, the code should be modified to pass 1 child that is a StatusBadge

Tasks

  • Add the children prop to QuestionBox.
  • Remove the participants prop.
  • Render all children in order below the main text.
  • Update all references to QuestionBox to use the new props.
  • Create a story showing the QuestionBox with the participants status badge, looking the same as the old implementation.
  • Create a story to showcase a questionbox with a participants badge and a complete badge on the same level, and a continue button.
  • Create another story with participants and "Round 3" badges on the same level, and View Summary and View My Activity buttons.

See app/components/point.jsx for an example of rendering children this way.

Figma

Image
Image

@ddfridley
Copy link
Contributor

@justin-b-yee

What about the continue button? I see that we will keep adding components within the QuestionBox as his project evolves I think it would be more extensible to have QuestionBox render children within it. We did this with the point.jsx And questionBox is stating to look a lot like a point, with a different format.

Should we have QuestionBox render children, where status badges, and maybe the continue button are children. Should we look at Point and have a different vState or pass a prop or something to it to make it take on the QuestionBox appearance?

@ddfridley
Copy link
Contributor

Yup, I see view status and view summary in the other issues, and I think children is the right answer.

@justin-b-yee justin-b-yee changed the title Status badge refactor for QuestionBox Render children for QuestionBox Oct 18, 2024
@ddfridley
Copy link
Contributor

@justin-b-yee I added reference to app/components/point.jsx and now I'm moving this to todo.

@gaikwadsanjeevv
Copy link

Interested to continue work on it.

@gaikwadsanjeevv
Copy link

Step 1: Refactor QuestionBox
// app/components/question-box.jsx

import React from 'react';
import { StatusBadge } from './StatusBadge'; // Adjust the import based on your structure
import cx from 'classnames';
import { createUseStyles } from 'react-jss';

const QuestionBox = ({ children = [], className = '', ...otherProps }) => {
const classes = useStyles();

return (
<div className={cx(classes.box, className)} {...otherProps}>


Your Question Here


{/* Render any additional content here */}

{children}



);
};

const useStyles = createUseStyles({
box: {
padding: '1rem',
border: '1px solid #ddd',
borderRadius: '0.5rem',
},
content: {
display: 'flex',
flexDirection: 'column',
},
childrenContainer: {
marginTop: '1rem',
},
});

export default QuestionBox;

==============================================================

//Updating References
//Findinding all instances of QuestionBox and update them. can be Step 2 by follwing way :

============================================================== // Setting up story :

// app/stories/QuestionBox.stories.jsx

import React from 'react';
import QuestionBox from '../components/question-box';
import StatusBadge from '../components/StatusBadge'; // Adjust the import based on your structure

export default {
title: 'QuestionBox',
component: QuestionBox,
};

export const WithStatusBadge = () => (



);

export const WithCompleteBadgeAndContinueButton = () => (



Continue

);

export const WithSummaryAndActivityButtons = () => (




View Summary
View My Activity


);

@ddfridley
Copy link
Contributor

@gaikwadsanjeevv did you move this into Ready for Review? I can't find a PR for it. See this for how to create a pr. https://github.com/EnCiv/.github/wiki/Contributing
If you have trouble with permissions, let me know.

@ddfridley
Copy link
Contributor

I'm moving it back to in progress, but please move it to ready to review again when ready.

@gaikwadsanjeevv
Copy link

gaikwadsanjeevv commented Nov 25, 2024 via email

@ddfridley ddfridley moved this from In Progress to Todo in EnCiv Cross Repo Project Management Mar 17, 2025
@justin-b-yee justin-b-yee self-assigned this Mar 20, 2025
@justin-b-yee justin-b-yee moved this from Todo to In Progress in EnCiv Cross Repo Project Management Mar 20, 2025
@justin-b-yee justin-b-yee linked a pull request Mar 20, 2025 that will close this issue
@justin-b-yee justin-b-yee moved this from In Progress to Ready for Review in EnCiv Cross Repo Project Management Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready for Review
Development

Successfully merging a pull request may close this issue.

3 participants