React - API data for content

0 votes
115 views
added Apr 16, 2021 in React by lcjr First Warrant Officer (10,930 points)
function FeaturedComponent({ isLoadedGPT, data, isMobile }) {
  const editorsPick = get(data, 'lordPick', []); 
  const doneDeals = get(data, 'gooddeals', []);
  

  const scrollToFeaturedContent = () => {
    window.scrollTo(0, scrollToRef.current.offsetTop - 54);
  };

  const onLordPick= () => {
    setNewsData(loadPick);
    setNewsType(0);
    if (isSticky) {
      scrollToFeaturedContent();
    }
  }; 
  const onGoodDeals = () => {
    setNewsData(goodDeals);
    setNewsType(2);
    if (isSticky) {
      scrollToFeaturedContent();
    }
  };
  
  return (
    <>
  
    <div
      css={css`
        display: flex;
        width: 100%;
      `}
    >
      <ul
        css={css`
          list-style: none;
          padding: 8px 0 16px;
          margin: 0;
          white-space: nowrap;
          overflow: auto;
          @media (max-width: 1199.98px) {
            padding: 0 0 8px;
          }
        `}
        role="tablist"
        aria-label="Property News"
      >
        <Li role="tab">
          <Button active={newsType === 0} onClick={lordPick}>
            <span> Editor's Pick</span>
          </Button>
        </Li> 
        <Li role="tab">
          <Button active={newsType === 2} onClick={onDoneDeals}>
            <span> Done Deals </span>
          </Button>
        </Li>  
      </ul>
    </div>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...