react-icons/fi#FiCircle TypeScript Examples

The following examples show how to use react-icons/fi#FiCircle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx    From dxvote with GNU Affero General Public License v3.0 4 votes vote down vote up
ProposalCard: React.FC<ProposalCardProps> = ({ id, href }) => {
  const { guild_id: guildId } = useParams<{ guild_id?: string }>();
  const { data: proposal } = useProposal(guildId, id);
  const votes = useVoteSummary(guildId, id);
  const { imageUrl, ensName } = useENSAvatar(proposal?.creator, MAINNET_ID);

  return (
    <UnstyledLink to={href || '#'}>
      <CardWrapper>
        <CardHeader>
          <IconDetailWrapper>
            {proposal?.creator ? (
              <Avatar src={imageUrl} defaultSeed={proposal.creator} size={24} />
            ) : (
              <Loading
                style={{ margin: 0 }}
                loading
                text
                skeletonProps={{ circle: true, width: '24px', height: '24px' }}
              />
            )}
            <Detail>
              {ensName ||
                (proposal?.creator ? (
                  shortenAddress(proposal.creator)
                ) : (
                  <Loading style={{ margin: 0 }} loading text />
                ))}
            </Detail>
          </IconDetailWrapper>
          <ProposalStatusWrapper>
            <ProposalStatus
              proposalId={id}
              bordered={false}
              showRemainingTime
            />
          </ProposalStatusWrapper>
        </CardHeader>
        <CardContent>
          <CardTitle size={2}>
            <strong>
              {proposal?.title || (
                <Loading style={{ margin: 0 }} loading text />
              )}
            </strong>
          </CardTitle>
        </CardContent>
        <CardFooter>
          {proposal?.value ? (
            <BorderedIconDetailWrapper>
              <Detail>150 ETH</Detail>
              {isDesktop && (
                <>
                  <Icon as="div" spaceLeft spaceRight>
                    <FiArrowRight />
                  </Icon>{' '}
                  <Detail>geronimo.eth</Detail>
                </>
              )}
            </BorderedIconDetailWrapper>
          ) : (
            <Loading
              style={{ margin: 0 }}
              skeletonProps={{ width: '200px' }}
              loading
              text
            />
          )}

          {proposal?.totalVotes ? (
            <BorderedIconDetailWrapper>
              {votes
                .sort((a, b) => b - a)
                .map((vote, i) => {
                  if (i < 3 && !(i === votes.length - 1)) {
                    return (
                      <>
                        <Detail>{vote}%</Detail>
                        <Icon as="div" spaceLeft spaceRight>
                          <FiCircle />
                        </Icon>
                      </>
                    );
                  } else {
                    return <Detail>{vote}%</Detail>;
                  }
                })}
            </BorderedIconDetailWrapper>
          ) : (
            <Loading
              style={{ margin: 0 }}
              loading
              text
              skeletonProps={{ width: '200px' }}
            />
          )}
        </CardFooter>
      </CardWrapper>
    </UnstyledLink>
  );
}
Example #2
Source File: lyric.tsx    From cloudmusic-vscode with MIT License 4 votes vote down vote up
Lyric = (): JSX.Element => {
  const [focus, setFocus] = useState(FocusMode.center);
  const [fontSize, setFontSize] = useState(bigFontSize - 8);
  bigFontSize = fontSize + 8;
  const [lyric, setLyric] = useState<NeteaseTypings.LyricData["text"]>([]);

  useEffect(() => {
    const handler = ({ data }: { data: LyricSMsg }) => {
      switch (data.command) {
        case "lyric":
          cnt += 1;
          setLyric(data.text);
          window.scrollTo({ top: 0, behavior: "smooth" });
          break;
        case "index":
          {
            const prev = document.getElementById(`${cnt}-${active}`);
            if (prev) {
              prev.style.fontSize = "";
              prev.style.opacity = "";
              prev.style.fontWeight = "";
            }
            active = data.idx;
            const curr = document.getElementById(`${cnt}-${active}`);
            if (curr) {
              curr.style.fontSize = `${bigFontSize}px`;
              curr.style.opacity = "1";
              curr.style.fontWeight = "bold";
              if (focus === FocusMode.center) {
                curr.scrollIntoView({ block: "center", behavior: "smooth" });
              } else if (focus === FocusMode.inview) {
                const { top, bottom } = curr.getBoundingClientRect();
                if (top > innerHeight || bottom < 0)
                  curr.scrollIntoView({ block: "center", behavior: "smooth" });
              }
            }
          }
          break;
      }
    };

    window.addEventListener("message", handler);
    return () => window.removeEventListener("message", handler);
  }, [focus]);

  return (
    <>
      {useMemo(
        () => (
          <>
            <div
              className="fixed right-8 bottom-8 bg-slate-700 rounded-full p-1 cursor-pointer z-10"
              onClick={() => setFontSize((v) => v - 2)}
            >
              <FiMinus size={32} />
            </div>
            <div
              className="fixed right-8 bottom-24 bg-slate-700 rounded-full p-1 cursor-pointer z-10"
              onClick={() => setFontSize((v) => v + 2)}
            >
              <FiPlus size={32} />
            </div>
          </>
        ),
        []
      )}

      {useMemo(() => {
        // eslint-disable-next-line @typescript-eslint/naming-convention
        const Icon =
          focus === FocusMode.center
            ? FiCrosshair
            : focus === FocusMode.inview
            ? FiLifeBuoy
            : FiCircle;
        return (
          <div
            className="fixed right-8 bottom-40 bg-slate-700 rounded-full p-1 cursor-pointer z-10"
            onClick={() => setFocus((v) => (v + 1) % 3)}
          >
            <Icon size={32} />{" "}
          </div>
        );
      }, [focus])}

      <style>{"body::-webkit-scrollbar{display: none;}"}</style>
      <div style={{ fontSize }} className="my-80">
        {lyric.map(([otext, ttext, rtext], idx) => (
          <div
            id={`${cnt}-${idx}`}
            key={`${cnt}-${idx}`}
            className="text-center text-ellipsis whitespace-nowrap flex flex-col gap-y-1 opacity-80 mb-8"
          >
            <div>{otext}</div>
            {rtext && <div>{rtext}</div>}
            {ttext && <div>{ttext}</div>}
          </div>
        ))}
      </div>
    </>
  );
}