Skip to content

Commit

Permalink
Use a truth table
Browse files Browse the repository at this point in the history
  • Loading branch information
switz committed Feb 21, 2024
1 parent 7dd1682 commit c4a5e24
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,14 @@ const CheckoutButton = ({ items, isLoading, checkout }) => {
}
```

If `isLoading` is the active state:
And we can represent our logic and ui as a truth table:

```js
shoppingCart.isDisabled => true
shoppingCart.intent => 'none'
shoppingCart.popover => undefined
```

Similarly, if `isCartEmpty` is the active state:
| | isDisabled | intent | popover |
|------------:|:----------:|:-------:|----------------|
| isLoading | true | none | |
| isCartEmpty | true | error | "Your cart..." |
| isCartValid | false | success | |

```js
shoppingCart.isDisabled => true
shoppingCart.intent => 'error'
shoppingCart.popover => 'Your cart is empty, please add items'
```

## 👩‍🏭 Basic Introduction

Expand Down

0 comments on commit c4a5e24

Please sign in to comment.