Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add section layout #1606

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/lib/makeswift/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import '~/makeswift/components/inline-email-form/inline-email-form.makeswift';
import '~/makeswift/components/slideshow/slideshow.makeswift';
import '~/makeswift/components/featured-image/featured-image.makeswift';
import '~/makeswift/components/sticky-sidebar-layout/sticky-sidebar-layout.makeswift';
import '~/makeswift/components/section-layout/section-layout.makeswift';

import { MakeswiftComponentType } from '@makeswift/runtime';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Select, Slot, Style } from '@makeswift/runtime/controls';

import { SectionLayout } from '@/vibes/soul/sections/section-layout';
import { runtime } from '~/lib/makeswift/runtime';

runtime.registerComponent(SectionLayout, {
type: 'section-layout',
label: 'Layouts / Section',
// icon: "accordion", TODO: (drew) add icon
props: {
className: Style(),
children: Slot(),
containerSize: Select({
label: 'Container Size',
options: [
{ value: 'lg', label: 'Large' },
{ value: 'xl', label: 'XL' },
{ value: '2xl', label: '2XL' },
],
defaultValue: '2xl',
}),
},
});
28 changes: 28 additions & 0 deletions core/vibes/soul/sections/section-layout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import clsx from 'clsx';

export function SectionLayout({
className,
children,
containerSize = '2xl',
}: {
className?: string;
children: React.ReactNode;
containerSize?: 'lg' | 'xl' | '2xl';
}) {
return (
<section className={clsx('@container', className)}>
<div
className={clsx(
'mx-auto px-4 py-10 @xl:px-6 @xl:py-14 @4xl:px-8 @4xl:py-20',
{
lg: 'max-w-screen-lg',
xl: 'max-w-screen-xl',
'2xl': 'max-w-screen-2xl',
}[containerSize],
)}
>
{children}
</div>
</section>
);
}
2 changes: 1 addition & 1 deletion core/vibes/soul/sections/sticky-sidebar-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function StickySidebarLayout({
<section className={clsx('@container', className)}>
<div
className={clsx(
'mx-auto flex flex-col items-stretch gap-x-16 gap-y-10 px-4 py-10 @xl:px-6 @xl:py-14 @2xl:flex-row @4xl:px-8 @4xl:py-20',
'mx-auto flex flex-col items-stretch gap-x-16 gap-y-10 px-4 py-10 @xl:px-6 @xl:py-14 @4xl:flex-row @4xl:px-8 @4xl:py-20',
{
lg: 'max-w-screen-lg',
xl: 'max-w-screen-xl',
Expand Down
Loading