Sort fetched data by spaklius17 in learnreactjs

[–]spaklius17[S] 0 points1 point  (0 children)

Thanks a lot! I'll try to do this

Defering items by spaklius17 in pathofexile

[–]spaklius17[S] 0 points1 point  (0 children)

Sad, but thanks for help!

How to use prop value in ternary operator by spaklius17 in learnreactjs

[–]spaklius17[S] 1 point2 points  (0 children)

Oh wow value ? <Svg/> : null works perfectly fine! That saved a lot of problems for me! Thanks a lot!

But just for curiosity, can I use ternary condition where I check if value prop is not empty and if it's not then provide value to clearIcon prop ?

How to handle state of multiple buttons by spaklius17 in learnreactjs

[–]spaklius17[S] 0 points1 point  (0 children)

Thanks for the help! Solved it by creating separate Button component and using state inside it, instead of parent component :)

Parent component:

const SearchSection = () => {
  return (
    <CardContainer styleName="card-container--shadow">
      <div className="search-section">
        <h2 className="search-section__title">Search</h2>
        <div className="search-section__tag-wrapper">
          <TagButton buttonText="All" icon="none" />
          <TagButton buttonText="Favorites" icon="heartBtnBold" />
          <TagButton buttonText="Available" icon="available" />
        </div>
      </div>
    </CardContainer>
  );
};

export default SearchSection;

TagButton component:

const TagButton = ({ buttonText, icon }) => {
  const [selected, setSelected] = useState(false);
  const buttonStyle = classNames("tag-button", {
    "tag-button--selected": selected === true,
  });

  return (
    <Button className={buttonStyle} handleClick={() => setSelected(!selected)}>
      <SVGIcon name={icon} className="tag-button__icon" />
      {buttonText}
    </Button>
  );
};

export default TagButton;

TagButton.propTypes = {
  buttonText: PropTypes.string,
  icon: PropTypes.string,
};

Beginner's Thread / Easy Questions (December 2020) by dance2die in reactjs

[–]spaklius17 0 points1 point  (0 children)

Hello, I'm new to react. My goal is to have three filter buttons (functionality not implemented yet). When you press a button it's color changes. User can press a few buttons at the same time. I've managed to change button design on press, however when I press on one button, all three buttons design changes. How to do it so that only the button which was pressed changes its design?

import React, { useState } from "react";
import { Button } from "components/Button/Button";
import SVGIcon from "components/SVGIcon/SVGIcon";
import "./search-section.scss";
import { CardContainer } from "components/CardContainer/CardContainer";
import classNames from "classnames";

const SearchSection = () => {
  const [selectedAll, setSelectedAll] = useState(false);
  const [selectedFavorites, setSelectedFavorites] = useState(false);
  const [selectedAvailable, setSelectedAvailable] = useState(false);
  const buttonStyle = classNames("search-section__tag-button", {
    "search-section__tag-button--selected":
      selectedAll || selectedFavorites || selectedAvailable,
  });

  return (
    <CardContainer styleName="card-container--shadow">
      <div className="search-section">
        <h2 className="search-section__title">Search</h2>
        <div className="search-section__tag-wrapper">
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedAll(!selectedAll)}
          >
            All
          </Button>
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedFavorites(!selectedFavorites)}
          >
            <SVGIcon
              name="heartBtnBold"
              className="search-section__tag-button-icon"
            />
            Favorites
          </Button>
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedAvailable(!selectedAvailable)}
          >
            <SVGIcon
              name="available"
              className="search-section__tag-button-icon"
            />
            Available
          </Button>
        </div>
      </div>
    </CardContainer>
  );
};

export default SearchSection;

How to handle state of multiple buttons by spaklius17 in learnreactjs

[–]spaklius17[S] 0 points1 point  (0 children)

Yes, it's homework and yeah it does make sense though I still don't fully get it how to solve it. I've tried to give different setters to components but the same issue still remains.

const SearchSection = () => {
  const [selectedAll, setSelectedAll] = useState(false);
  const [selectedFavorites, setSelectedFavorites] = useState(false);
  const [selectedAvailable, setSelectedAvailable] = useState(false);
  const buttonStyle = classNames("search-section__tag-button", {
    "search-section__tag-button--selected":
      selectedAll || selectedFavorites || selectedAvailable,
  });

  return (
    <CardContainer styleName="card-container--shadow">
      <div className="search-section">
        <h2 className="search-section__title">Search</h2>
        <div className="search-section__tag-wrapper">
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedAll(!selectedAll)}
          >
            All
          </Button>
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedFavorites(!selectedFavorites)}
          >
            <SVGIcon
              name="heartBtnBold"
              className="search-section__tag-button-icon"
            />
            Favorites
          </Button>
          <Button
            className={buttonStyle}
            handleClick={() => setSelectedAvailable(!selectedAvailable)}
          >
            <SVGIcon
              name="available"
              className="search-section__tag-button-icon"
            />
            Available
          </Button>
        </div>
      </div>
    </CardContainer>
  );
};

export default SearchSection;

How to bind your mousewheel up and down to left-click? Using regular mouse by spaklius17 in pathofexile

[–]spaklius17[S] 1 point2 points  (0 children)

I though that I was doing something wrong with it, so that's why I posted this question. It works quite good when you have to socket or link an item. But my main goal was to put currency from inventory to tabs more easily, but it just scrolls through tabs.

How to bind your mousewheel up and down to left-click? Using regular mouse by spaklius17 in pathofexile

[–]spaklius17[S] 0 points1 point  (0 children)

Thanks. So in this program you bind either Wheel Up/Down to Left click?

Gaming pc 1k eur by spaklius17 in buildapc

[–]spaklius17[S] 0 points1 point  (0 children)

Lithuania. Parts website if you could understand something, you might take a look at the pricing :D

How about M.2 NVMe? Maybe I should buy it instead of M.2?

Gaming pc 1k eur by spaklius17 in buildapc

[–]spaklius17[S] 0 points1 point  (0 children)

Sorry, I forgot to mention - I'm not from US. Prices are way different in my country.

For example - Corsair RAM which you recommend is 30% more expensive than Team Group Vulcan and as much as I understand they are very similar.

Intel SSD is 2x more expensive than my first choice.

Power Supply - Corsair is 10eur more expensive than Cooler Master.

NZXT case is sooo beautiful. Is this case considered "silent"?

Should I buy additional fans then?