Skip to content

Instantly share code, notes, and snippets.

@ac205
Created January 19, 2020 04:28
Show Gist options
  • Save ac205/0309331cdc4b1d81409c8eb845113e59 to your computer and use it in GitHub Desktop.
Save ac205/0309331cdc4b1d81409c8eb845113e59 to your computer and use it in GitHub Desktop.
SaleBar
case "SET_SALEBAR_DATA":
action.payload.num === 1
? (state = {
...state,
saleBar: [...state.saleBar[0], action.payload.data]
})
: action.payload.num === 2
? (state = {
...state,
saleBar: [...state.saleBar[1], action.payload.data]
})
: (state = {
...state,
saleBar: [...state.saleBar[2], action.payload.data]
});
break;
state = {
saleBar: [
{
img:
"https://embryo-react.theironnetwork.org/static/media/sale-1.d43129a2.jpg",
top: "Sale",
middle: "Women's Collection",
bottom: "50% OFF",
link: "/shop"
},
{
img:
"https://embryo-react.theironnetwork.org/static/media/sale-2.9b211b56.jpg",
top: "New Arrivals",
middle: "2020 Collection",
bottom: "ON SALE NOW",
link: "/shop"
},
{
img:
"https://embryo-react.theironnetwork.org/static/media/sale-3.87084ce9.jpg",
top: "Sale",
middle: "Men's Collection",
bottom: "60% OFF",
link: "/shop"
}
]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment