Skip to content

Commit

Permalink
Merge pull request #627 from evershopcommerce/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
treoden authored Sep 13, 2024
2 parents 83fee67 + 797db86 commit 1d53923
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 23 deletions.
10 changes: 6 additions & 4 deletions packages/evershop/src/components/common/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,19 @@ RenderEditorJS.propTypes = {
export default function Editor({ rows }) {
return (
<div className="editor__html">
{rows.map((row) => {
{rows.map((row, index) => {
const rowClasses = getRowClasses(row.size);
return (
<div
className={`row__container mt-12 grid md:${rowClasses} grid-cols-1 gap-8`}
key={index}
>
{row.columns.map((column) => {
{row.columns.map((column, index) => {
const columnClasses = getColumnClasses(column.size);
return (
<div
className={`column__container md:${columnClasses} col-span-1`}
key={index}
>
{column.data?.blocks && (
<RenderEditorJS blocks={column.data?.blocks} />
Expand All @@ -178,10 +180,10 @@ export default function Editor({ rows }) {
Editor.propTypes = {
rows: PropTypes.arrayOf(
PropTypes.shape({
size: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
columns: PropTypes.arrayOf(
PropTypes.shape({
size: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
// eslint-disable-next-line react/forbid-prop-types
data: PropTypes.object
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function Quantity({ qty, api }) {
>
{isLoading && (
<svg
ariaHidden="true"
aria-hidden="true"
focusable="false"
role="presentation"
className="spinner"
Expand All @@ -83,7 +83,7 @@ export default function Quantity({ qty, api }) {
{!isLoading && (
<svg
xmlns="http://www.w3.org/2000/svg"
ariaHidden="true"
aria-hidden="true"
focusable="false"
role="presentation"
className="icon icon-minus"
Expand All @@ -99,7 +99,7 @@ export default function Quantity({ qty, api }) {
</svg>
)}
</button>
<input type="text" value={quantity} />
<input type="text" value={quantity} readOnly />
<button
className="flex justify-center items-center"
onClick={() => updateQuantity(quantity + 1)}
Expand All @@ -108,7 +108,7 @@ export default function Quantity({ qty, api }) {
>
{isLoading && (
<svg
ariaHidden="true"
aria-hidden="true"
focusable="false"
role="presentation"
className="spinner"
Expand All @@ -128,7 +128,7 @@ export default function Quantity({ qty, api }) {
{!isLoading && (
<svg
xmlns="http://www.w3.org/2000/svg"
ariaHidden="true"
aria-hidden="true"
focusable="false"
role="presentation"
className="icon icon-plus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ export default function Description({ product: { description } }) {

Description.propTypes = {
product: PropTypes.shape({
description: PropTypes.string
description: PropTypes.arrayOf(
PropTypes.shape({
size: PropTypes.number.isRequired,
columns: PropTypes.arrayOf(
PropTypes.shape({
size: PropTypes.number.isRequired,
// eslint-disable-next-line react/forbid-prop-types
data: PropTypes.object
})
).isRequired
})
).isRequired
}).isRequired
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ Options.propTypes = {
optionName: PropTypes.string,
optionType: PropTypes.string
})
).isRequired
)
};

Options.defaultProps = {
options: []
};

export const layout = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ export default function Variants({
<input
name={`variant_options[${i}][attribute_id]`}
type="hidden"
value={a.attributeId}
value={a.attributeId || ''}
/>
<input
name={`variant_options[${i}][optionId]`}
type="hidden"
value={a.selectedOption}
value={a.selectedOption || ''}
/>
<div className="mb-2 text-textSubdued uppercase">
<span>{a.attribute_name}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const {
OK
} = require('@evershop/evershop/src/lib/util/httpStatus');
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
const { error } = require('@evershop/evershop/src/lib/log/logger');
const {
translate
} = require('@evershop/evershop/src/lib/locale/translate/translate');
Expand Down Expand Up @@ -107,7 +106,6 @@ module.exports = async (request, response, delegate, next) => {
};
next();
} catch (e) {
error(e);
response.status(INTERNAL_SERVER_ERROR);
response.json({
error: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Title.propTypes = {
title: PropTypes.string.isRequired
};

export default function ShoppingCart({ cart, setting, removeUrl }) {
export default function ShoppingCart({ cart, setting }) {
const { totalQty = 0, items = [] } = cart || {};
if (totalQty <= 0) {
return <Empty />;
Expand Down Expand Up @@ -53,7 +53,7 @@ export default function ShoppingCart({ cart, setting, removeUrl }) {
coreComponents={[
{
component: { default: Items },
props: { items, setting, cartId: cart.uuid, removeUrl },
props: { items, setting },
sortOrder: 10,
id: 'shoppingCartTitle'
}
Expand All @@ -78,8 +78,7 @@ ShoppingCart.propTypes = {
}).isRequired,
setting: PropTypes.shape({
priceIncludingTax: PropTypes.bool
}).isRequired,
removeUrl: PropTypes.string.isRequired
}).isRequired
};

export const layout = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ function Subtotal({ subTotal }) {
}

Subtotal.propTypes = {
subTotal: PropTypes.number
subTotal: PropTypes.shape({
value: PropTypes.number,
text: PropTypes.string
})
};

Subtotal.defaultProps = {
subTotal: 0
subTotal: {
value: 0,
text: ''
}
};

function Discount({ discountAmount, coupon }) {
Expand All @@ -36,12 +42,18 @@ function Discount({ discountAmount, coupon }) {
}

Discount.propTypes = {
discountAmount: PropTypes.number,
discountAmount: PropTypes.shape({
value: PropTypes.number,
text: PropTypes.string
}),
coupon: PropTypes.string
};

Discount.defaultProps = {
discountAmount: 0,
discountAmount: {
value: 0,
text: ''
},
coupon: ''
};

Expand Down

0 comments on commit 1d53923

Please sign in to comment.