Skip to content

Commit

Permalink
Bump (vercel#642)
Browse files Browse the repository at this point in the history
* Packages Bump

* Code Updated

* More API Changes

* Working updates

* Updated Tailwind Config

* SWR API updates

* More changes

* Commercejs Types

* Commercejs Types

* Commercejs Types
  • Loading branch information
okbel authored Jan 13, 2022
1 parent 33d4a32 commit f3cdbe6
Show file tree
Hide file tree
Showing 39 changed files with 11,040 additions and 20,546 deletions.
8 changes: 3 additions & 5 deletions components/auth/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import useLogin from '@framework/auth/use-login'
import { useUI } from '@components/ui/context'
import { validate } from 'email-validator'

interface Props {}

const LoginView: FC<Props> = () => {
const LoginView: React.FC = () => {
// Form State
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
Expand Down Expand Up @@ -35,8 +33,8 @@ const LoginView: FC<Props> = () => {
})
setLoading(false)
closeModal()
} catch ({ errors }) {
setMessage(errors[0].message)
} catch (e: any) {
setMessage(e.errors[0].message)
setLoading(false)
setDisabled(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useCheckoutContext } from '../context'
const CheckoutSidebarView: FC = () => {
const [loadingSubmit, setLoadingSubmit] = useState(false)
const { setSidebarView, closeSidebar } = useUI()
const { data: cartData, revalidate: refreshCart } = useCart()
const { data: cartData, mutate: refreshCart } = useCart()
const { data: checkoutData, submit: onCheckout } = useCheckout()
const { clearCheckoutFields } = useCheckoutContext()

Expand Down
9 changes: 4 additions & 5 deletions components/common/FeatureBar/FeatureBar.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.root {
@apply text-center p-6 bg-primary text-sm flex-row justify-center items-center font-medium fixed bottom-0 w-full z-30 transition-all duration-300 ease-out;

@screen md {
@apply flex text-left;
}
@apply text-center p-6 bg-primary text-sm flex-row
justify-center items-center font-medium fixed bottom-0
w-full z-30 transition-all duration-300 ease-out
md:flex md:text-left;
}
22 changes: 12 additions & 10 deletions components/common/I18nWidget/I18nWidget.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@

.dropdownMenu {
@apply fixed right-0 top-12 mt-2 origin-top-right outline-none bg-primary z-40 w-full h-full;

@screen lg {
@apply absolute border border-accent-1 shadow-lg w-56 h-auto;
}
}

.closeButton {
@screen md {
@apply hidden;
}
}

.item {
Expand All @@ -44,3 +34,15 @@
.icon.active {
transform: rotate(180deg);
}

@screen lg {
.dropdownMenu {
@apply absolute border border-accent-1 shadow-lg w-56 h-auto;
}
}

@screen md {
.closeButton {
@apply hidden;
}
}
10 changes: 6 additions & 4 deletions components/common/UserNav/DropdownMenu.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
.dropdownMenu {
@apply fixed right-0 mt-2 origin-top-right outline-none bg-primary z-40 w-full h-full;

@screen lg {
@screen lg {
.dropdownMenu {
@apply absolute top-10 border border-accent-1 shadow-lg w-56 h-auto;
}
}

.dropdownMenu {
@apply fixed right-0 mt-2 origin-top-right outline-none bg-primary z-40 w-full h-full;
}

.link {
@apply text-primary flex cursor-pointer px-6 py-3 flex transition ease-in-out duration-150 leading-6 font-medium items-center;
text-transform: capitalize;
Expand Down
88 changes: 43 additions & 45 deletions components/product/Swatch/Swatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,50 @@ interface SwatchProps {
label?: string | null
}

const Swatch: React.FC<Omit<ButtonProps, 'variant'> & SwatchProps> = React.memo(
({
active,
className,
color = '',
label = null,
variant = 'size',
...props
}) => {
variant = variant?.toLowerCase()
const Swatch: React.FC<Omit<ButtonProps, 'variant'> & SwatchProps> = ({
active,
className,
color = '',
label = null,
variant = 'size',
...props
}) => {
variant = variant?.toLowerCase()

if (label) {
label = label?.toLowerCase()
}
if (label) {
label = label?.toLowerCase()
}

const swatchClassName = cn(
s.swatch,
{
[s.color]: color,
[s.active]: active,
[s.size]: variant === 'size',
[s.dark]: color ? isDark(color) : false,
[s.textLabel]: !color && label && label.length > 3,
},
className
)
const swatchClassName = cn(
s.swatch,
{
[s.color]: color,
[s.active]: active,
[s.size]: variant === 'size',
[s.dark]: color ? isDark(color) : false,
[s.textLabel]: !color && label && label.length > 3,
},
className
)

return (
<Button
role="option"
aria-selected={active}
aria-label={variant && label ? `${variant} ${label}` : 'Variant Swatch'}
className={swatchClassName}
{...(label && color && { title: label })}
style={color ? { backgroundColor: color } : {}}
{...props}
>
{color && active && (
<span>
<Check />
</span>
)}
{!color ? label : null}
</Button>
)
}
)
return (
<Button
role="option"
aria-selected={active}
aria-label={variant && label ? `${variant} ${label}` : 'Variant Swatch'}
className={swatchClassName}
{...(label && color && { title: label })}
style={color ? { backgroundColor: color } : {}}
{...props}
>
{color && active && (
<span>
<Check />
</span>
)}
{!color ? label : null}
</Button>
)
}

export default Swatch
export default React.memo(Swatch)
1 change: 1 addition & 0 deletions components/ui/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
disabled?: boolean
}

// eslint-disable-next-line react/display-name
const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
const {
className,
Expand Down
6 changes: 3 additions & 3 deletions components/ui/Collapse/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface CollapseProps {
children: ReactNode
}

const Collapse: FC<CollapseProps> = React.memo(({ title, children }) => {
const Collapse: FC<CollapseProps> = ({ title, children }) => {
const [isActive, setActive] = useState(false)
const [ref, { height: viewHeight }] = useMeasure()

Expand Down Expand Up @@ -41,6 +41,6 @@ const Collapse: FC<CollapseProps> = React.memo(({ title, children }) => {
</a.div>
</div>
)
})
}

export default Collapse
export default React.memo(Collapse)
83 changes: 32 additions & 51 deletions components/ui/Grid/Grid.module.css
Original file line number Diff line number Diff line change
@@ -1,53 +1,25 @@
.root {
@apply grid grid-cols-1 gap-0;

@screen lg {
@apply grid-cols-3 grid-rows-2;
}

& > * {
@apply row-span-1 bg-transparent box-border overflow-hidden;
height: 500px;
max-height: 800px;

@screen lg {
@apply col-span-1;
height: inherit;
}
}
}
.root > * {
@apply row-span-1 bg-transparent box-border overflow-hidden;
height: 500px;
max-height: 800px;
}

.default {
& > * {
@apply bg-transparent;
}
.default > * {
@apply bg-transparent;
}

.layoutNormal {
@apply gap-3;
}

@screen md {
.layoutNormal > * {
max-height: min-content !important;
}
}

@screen lg {
.layoutNormal > * {
max-height: 400px;
}
}

.layoutA {
& > *:nth-child(6n + 1),
& > *:nth-child(6n + 5) {
@apply row-span-2;
@apply row-span-2 lg:col-span-2;
height: var(--row-height);

@screen lg {
@apply col-span-2;
}
}

&.filled {
Expand All @@ -72,12 +44,8 @@
.layoutB {
& > *:nth-child(6n + 2),
& > *:nth-child(6n + 4) {
@apply row-span-2;
@apply row-span-2 lg:col-span-2;
height: var(--row-height);

@screen lg {
@apply col-span-2;
}
}

&.filled {
Expand All @@ -102,12 +70,8 @@
.layoutC {
& > *:nth-child(12n + 1),
& > *:nth-child(12n + 8) {
@apply row-span-2;
@apply row-span-2 lg:col-span-2;
height: var(--row-height);

@screen lg {
@apply col-span-2;
}
}

&.filled {
Expand All @@ -130,12 +94,8 @@
.layoutD {
& > *:nth-child(12n + 2),
& > *:nth-child(12n + 7) {
@apply row-span-2;
@apply row-span-2 lg:col-span-2;
height: var(--row-height);

@screen lg {
@apply col-span-2;
}
}

&.filled {
Expand All @@ -152,3 +112,24 @@
}
}
}

@screen md {
.layoutNormal > * {
max-height: min-content !important;
}
}

@screen lg {
.root {
@apply grid-cols-3 grid-rows-2;
}

.root > * {
@apply col-span-1;
height: inherit;
}

.layoutNormal > * {
max-height: 400px;
}
}
6 changes: 3 additions & 3 deletions framework/bigcommerce/auth/use-login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export const handler: MutationHook<LoginHook> = {
useHook:
({ fetch }) =>
() => {
const { revalidate } = useCustomer()
const { mutate } = useCustomer()

return useCallback(
async function login(input) {
const data = await fetch({ input })
await revalidate()
await mutate()
return data
},
[fetch, revalidate]
[fetch, mutate]
)
},
}
6 changes: 3 additions & 3 deletions framework/bigcommerce/auth/use-signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export const handler: MutationHook<SignupHook> = {
useHook:
({ fetch }) =>
() => {
const { revalidate } = useCustomer()
const { mutate } = useCustomer()

return useCallback(
async function signup(input) {
const data = await fetch({ input })
await revalidate()
await mutate()
return data
},
[fetch, revalidate]
[fetch, mutate]
)
},
}
Loading

0 comments on commit f3cdbe6

Please sign in to comment.