Skip to content

Commit

Permalink
Implementing the functionality of the <StyledButton /> Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch-sriram committed Aug 4, 2020
1 parent 503499a commit afd95bf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ NOTE: There can be more additions into the design, over iterations of the Applic
15. Showing/Hiding the `<OrderSummary />` Modal Component w. Animation: [Commit Details](https://github.com/Ch-sriram/burger-builder/commit/c50a7880b846b16bb0b1267034faf945d18f40e0)
16. Implementing a `<Backdrop />` Component: [Commit Details](https://github.com/Ch-sriram/burger-builder/commit/d97b727fe03205c73aaad09d223f08dd18febcb4)
17. Adding a Custom Button `<StyledButton />` Component: [Commit Details](https://github.com/Ch-sriram/burger-builder/commit/d97b727fe03205c73aaad09d223f08dd18febcb4)
18. Implementing the Functionality of the `<StyledButton />` Component: [Commit Details]()
9 changes: 9 additions & 0 deletions src/components/Burger/OrderSummary/OrderSummary.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import styled from 'styled-components';
// CUSTOM COMPONENTS
import Aux from '../../../hoc/Auxiliary/Auxiliary.hoc';

// STYLED IMPORTS
import { StyledButton as Button } from '../../UI/Buttons/StyledButton.styled';

const UL = styled.ul`list-style-type: circle;`;

const orderSummary = props => {
Expand All @@ -22,6 +25,12 @@ const orderSummary = props => {
<UL>{ingredientSummary}</UL>
<h4>Price: ${props.price.toFixed(2)}</h4>
<p>Continue to Checkout?</p>
<Button
type="danger"
onClick={props.orderCancelled}>CANCEL</Button>
<Button
type="success"
onClick={props.orderContinued}>CONTINUE</Button>
</Aux>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/UI/Buttons/StyledButton.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const StyledButton = styled.button`
padding: 10px;
margin: 10px;
font-weight: bold;
color: ${props => props.color.toLowerCase() === 'success' ? '#5C9210' : '#944317'};
color: ${props => props.type.toLowerCase() === 'success' ? '#5C9210' : '#944317'};
&:first-of-type {
margin-left: 0;
Expand Down
6 changes: 6 additions & 0 deletions src/containers/BurgerBuilder/BurgerBuilder.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class BurgerBuilder extends Component {
this.setState({ orderNow: false });
}

orderContinueHandler = () => {
alert('Order Placed!');
}

render() {
const disabledInfo = { ...this.state.ingredients };
for (let key in disabledInfo) {
Expand All @@ -89,6 +93,8 @@ class BurgerBuilder extends Component {
<OrderSummary
ingredients={this.state.ingredients}
price={this.state.totalPrice}
orderCancelled={this.orderCancelHandler}
orderContinued={this.orderContinueHandler}
/>
</Modal>
<Burger ingredients={this.state.ingredients}/>
Expand Down

0 comments on commit afd95bf

Please sign in to comment.