All files / store/components/EmptyResultSection EmptyResultSection.tsx

33.33% Statements 1/3
100% Branches 0/0
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91            1x                                                                                                                                                                        
import { Col, Link, List, Row, Strip } from "@canonical/react-components";
import { SearchInput } from "../SearchInput";
import { PackageFilter } from "../PackageFilter";
import { Store } from "../../types";
import { useRef } from "react";
 
export const EmptyResultSection = ({
  searchTerm,
  data,
  isFetching,
}: {
  searchTerm: string | null;
  data?: Store;
  isFetching: boolean;
}) => {
  const searchRef = useRef<HTMLInputElement | null>(null);
 
  return (
    <Strip>
      <Row>
        <Col size={3}>
          <PackageFilter data={data} disabled={isFetching} />
        </Col>
 
        <Col size={9}>
          <Row>
            <Col size={9}>
              <h1 className="p-heading--2">
                Search results for "{searchTerm}"
              </h1>
              <SearchInput searchRef={searchRef} />
            </Col>
          </Row>
          <Row>
            <Col size={4}>
              <h2 className="p-heading--4">
                Why not trying widening your search?
              </h2>
              <p className="p-heading--4">You can do this by:</p>
            </Col>
            <Col size={4}>
              <List
                items={[
                  "Adding alternative words or phrases",
                  "Using individual words instead of phrases",
                  "Trying a different spelling",
                ]}
                ticked
              />
            </Col>
          </Row>
 
          <Row>
            <Col size={9}>
              <div className="u-fixed-width u-hide--small u-hide--medium">
                <hr className="p-rule" />
              </div>
            </Col>
          </Row>
 
          <Row>
            <Col size={4}>
              <h2 className="p-heading--4">Still no luck?</h2>
            </Col>
            <Col size={4} className="snap-packages__empty-more-options">
              <List
                items={[
                  <Link
                    href="/store?categories=featured"
                    key={"explore-snaps"}
                    className={"snap-packages__list-item"}
                  >
                    Explore featured snaps
                  </Link>,
                  <Link
                    href="/about/contact-us"
                    key={"contact-us"}
                    className={"snap-packages__list-item"}
                  >
                    Contact us
                  </Link>,
                ]}
              />
            </Col>
          </Row>
        </Col>
      </Row>
    </Strip>
  );
};