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

Style poll results #35

Open
asifkabani opened this issue Jul 22, 2022 · 7 comments
Open

Style poll results #35

asifkabani opened this issue Jul 22, 2022 · 7 comments

Comments

@asifkabani
Copy link

I was wondering what tweaks can I make to style my poll results like this:
image

@salalo
Copy link
Owner

salalo commented Jul 22, 2022

Hi @asifkabani

Currently there is no support to style individual bars of a poll. You probably could achieve something like this by implementing useRef hook on the fork yourself.

@asifkabani
Copy link
Author

@salalo thanks for the information. Is there a way to have number of votes show up for an answer vs the percentage?

@salalo
Copy link
Owner

salalo commented Jul 25, 2022

@asifkabani No, currently there is not but it would be fairly easy to implement, so maybe soon.

@asifkabani
Copy link
Author

@salalo one other thing, if I set the isVoted prop to true, wondering why the percentage values don't show up

Here is my code:

const PollResults = ({ question, handleVote }) => {
  const themeData = {
    textColor: "#2B355C",
    mainColor: "#f3e7fa",
    backgroundColor: "#F5F5F7",
    alignment: "end",
  };

  const resData = [
    { id: 0, text: "React", votes: 9 },
    { id: 1, text: "Vue", votes: 7 },
    { id: 2, text: "Angular", votes: 2 },
  ];

  return (
    <>
      <Text fontWeight="600" fontSize="12px" color="#2B355C" mb="1">
        {question}
      </Text>
      <LeafPoll
        type="multiple"
        results={resData}
        theme={themeData}
        onVote={handleVote}
        isVoted={true}
        isVotedId={1}
      />
    </>
  );
};

export default PollResults;

image

@salalo
Copy link
Owner

salalo commented Jul 25, 2022

@asifkabani I've seen that bug but it's pretty irregular, I'll try to replicate and fix it. You can try different version of the package to see if it helps.

@asifkabani
Copy link
Author

asifkabani commented Aug 5, 2022

@salalo I want to see if I can help contribute to this package. Is there a guide I can follow to figure out:

  • After I fork, how do I use the forked version
  • How do I see the source code to modify and check if it works in my local environment
  • submit a PR for the fix

I want to use this package within my application to work on it

@hwb15
Copy link
Contributor

hwb15 commented Sep 14, 2022

@asifkabani I've seen that bug but it's pretty irregular, I'll try to replicate and fix it. You can try different version of the package to see if it helps.

I'll take a look at this also and try replicate, think I've seen a similar issue where I use it in prod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants