Skip to content

Commit

Permalink
wip: css
Browse files Browse the repository at this point in the history
fix: change button css behaviour to {Card,Button,NavPanel,ProviderInfo}.{jsx,css}
  • Loading branch information
SirrorsMoore1975 authored and SirrorsMoore1975 committed Dec 8, 2023
1 parent 8069a5f commit 7d4b72a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 23 deletions.
20 changes: 15 additions & 5 deletions client/src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import React from "react";
import React, {useMemo} from "react";
import "../styles/Button.css";

const Button = (props) => {
const { className, onClick, text } = props;
const Button = ({ className, onClick, text }) => {
const classNameData = useMemo(()=>{
if(className){
return {
"default": `${className}`
}
} else {
return {
"default": "button"
}
}
},[className])

return (
<button
className={className}
className={classNameData.default}
onClick={onClick}
>{ text }</button>
);
};

Button.defaultProps = {
className: "",
className: "default_btn",
onClick: () => {},
text: "",
};
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {React, useState, useEffect} from 'react';
import Button from './Button';
import '../styles/Card.css'

const Card = (props) => {
const { description, divClassName, onClick, onChange, cardName, imgClassName, img_url, altValue, averageScoreClassName ,averageScore, buttonClassName } = props;
const Card = ({ description, divClassName, onClick, onChange, cardName, imgClassName, img_url, altValue, averageScoreClassName ,averageScore, buttonClassName }) => {

/*
You can console.log(className) to see what it returns
Expand Down Expand Up @@ -38,7 +39,7 @@ const Card = (props) => {


<p className="description">{description}</p>
<button className ="detailsButton" onClick = {onClick} onChange = {onChange}>Learn More</button>
<Button className ="detailsButton" onClick = {onClick} text={"Learn More"}/>
</div>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/NavPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ const NavPanel = ({provider_id}) => {
<div className="nav-panel">
<div className="nav-arrows">
<span>
<Button className="button arrow" text={"<"} onClick={handleGoLeft} />
<Button className="arrow" text={"<"} onClick={handleGoLeft} />

</span>
<span>
<Button className="button arrow" text={">"} onClick={handleGoRight} />
<Button className="arrow" text={">"} onClick={handleGoRight} />
</span>

</div>
<div className="current-provider">
<span >
<Button className="button" text={
<Button className="provider_btn" text={
<span className="provider_name">
{
`${providers[provider_data?.current].name}`
Expand Down
10 changes: 6 additions & 4 deletions client/src/components/ProviderInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const ProviderInfo = ({provider, provider_id}) => {
<p>{provider.description}</p>
<a href={provider.site_url}>Click here for the provider website.</a>
</div>
<div className="hero-right">
<Button className="button" text="Home" onClick={() => navigate('/')}/>
<div>
<NavPanel provider_id={provider_id}/>
<div className="utilities-panel">
<div className="hero-right">
<Button className="button" text="Home" onClick={() => navigate('/')}/>
<div>
<NavPanel provider_id={provider_id}/>
</div>
</div>
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion client/src/styles/Button.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
.button {
height:50px;
width: 100px;
margin: 15px;
padding: 10px;
align-self: flex-end;
color: white;
background-color: black;
background-color: pink;
border-radius: 10px;
border-color: 1px solid pink;
font-size:15px;
}

.button:hover {
background-color: rrgb(255, 152, 170);;
cursor: pointer;
}

.review {
Expand Down
5 changes: 0 additions & 5 deletions client/src/styles/Card.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ p.description {
border-color: 1px solid pink;
}

button:hover {
background-color: rrgb(255, 152, 170);;
cursor: pointer;
}

.red {
font-weight: bold;
font-size: 30px;
Expand Down
17 changes: 15 additions & 2 deletions client/src/styles/NavPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
/* display: flex; */
}
.arrow {
background-color:pink;
border-radius: 12px;
width: 25px;
align-items: center;
/* display: flex; */
flex-direction: row;
border-color: 1px solid pink;
font-size:20px;
}
.nav-arrows {
padding: 20px;
Expand All @@ -20,13 +25,21 @@
flex-direction: column;
/* width: 200px; */
}

.provider_btn {
width: 200px;
height: 75px;
}

.provider_name {
display: inline-block;
/* cursor: pointer; */
/* display: flex; */
/* align-items: center; */
/* flex-direction: row; */
/* padding: 0px; */
padding: 0px;
/* height: 0px; */
/* width: 100%; */
/* margin: 0px; */
margin: 0px;
/* text-align: center; */
}
6 changes: 6 additions & 0 deletions client/src/styles/ProviderInfo.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ body {
width: 50%;
}

.utilities-panel {
display: flex;
flex-direction: column;
align-items: flex-end;
}

.hero-right {
margin: 10px;
display: flex;
Expand Down

0 comments on commit 7d4b72a

Please sign in to comment.