Skip to content

Commit

Permalink
fix(components page & minimal refactoring elsewhere): add icons to co…
Browse files Browse the repository at this point in the history
…mpoents page and refactor

Refactor components page to include the icons available to this project; move components related to
the home page to that subfolder; update Hero Section, Button Component and Search Box to use Icon
component
  • Loading branch information
joekotvas committed Oct 23, 2023
1 parent 92e7f97 commit b256bb1
Show file tree
Hide file tree
Showing 11 changed files with 235 additions and 207 deletions.
6 changes: 3 additions & 3 deletions src/features/ui/SearchBox/SearchBox.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import { search } from "@/assets";
import debounce from "lodash/debounce";
import PropTypes from "prop-types";
import { Icon } from "@/features/ui/Icon";
export const SearchBox = ({ onSearch }) => {
const [localTerm, setLocalTerm] = useState("");
const debouncedSearch = debounce(onSearch, 1500);
Expand Down Expand Up @@ -34,10 +34,10 @@ export const SearchBox = ({ onSearch }) => {
className="w-full p-2 pl-6 text-sm rounded-l-full lg:text-base bg-earlyDawn-100 focus:outline-none placeholder:text-lava-300 text-lava-950 focus:ring-none"
/>
<button
className="px-4 rounded-r-full bg-tangerine-400 hover:bg-tangerine-600"
className="px-4 rounded-r-full text-white bg-tangerine-400 hover:bg-tangerine-600 flex flex-col align-middle justify-center text-3xl"
onClick={() => handleSearch()}
>
<img src={search} alt="search icon" />
<Icon name="search" />
</button>
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/features/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./StarRating";
export * from "./SearchBox";
export * from "./Footer";
export * from "./Icon";
export * from "./Heading";
197 changes: 0 additions & 197 deletions src/pages/Components.jsx

This file was deleted.

58 changes: 58 additions & 0 deletions src/pages/components/Buttons.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Button } from "@/features/ui/Button";
import { Icon } from "@/features/ui/Icon";
import { Heading } from "@/features/ui/Heading";

function Buttons() {
return (
<section id="buttons">
<Heading level="h3" variant="tangerine">
Buttons
</Heading>
<div className="grid gap-3 grid-cols-2">
<ul className="grid gap-3">
<li>
<Button variant="primary" size="small">
Small, primary button
<Icon name="right-arrow" />
</Button>
</li>
<li>
<Button variant="primary" size="medium">
Medium, primary button
<Icon name="right-arrow" />
</Button>
</li>
<li>
<Button variant="primary" size="large">
Large, primary button!
<Icon name="right-arrow" />
</Button>
</li>
</ul>

<ul className="grid gap-3">
<li>
<Button variant="secondary" size="small">
Small, secondary button
<Icon name="right-arrow" className="scale-175" />
</Button>
</li>
<li>
<Button variant="secondary" size="medium">
Medium, secondary button
<Icon name="right-arrow" className="scale-175" />
</Button>
</li>
<li>
<Button variant="secondary" size="large">
Large, secondary button!
<Icon name="right-arrow" className="scale-175" />
</Button>
</li>
</ul>
</div>
</section>
);
}

export default Buttons;
20 changes: 20 additions & 0 deletions src/pages/components/Components.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Buttons from "./Buttons";
import Icons from "./Icons";
import Headings from "./Headings";

import { Heading } from "@/features/ui/Heading";

function Components() {
return (
<section className="p-10">
<Heading level="h2" variant="lava" className="mb-6">
Components
</Heading>
<Buttons />
<Icons />
<Headings />
</section>
);
}

export default Components;
Loading

0 comments on commit b256bb1

Please sign in to comment.