-
Notifications
You must be signed in to change notification settings - Fork 0
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/lib 1271 fzlayout #174
base: main
Are you sure you want to change the base?
Conversation
}) | ||
|
||
expect(wrapper.html()).toMatchSnapshot() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add other tests based on the values the layout can take
packages/layout/src/FzLayout.vue
Outdated
<template v-if="['twoColumns', 'leftShoulder', 'rightShoulderNavbar', 'squares'].includes(props.layout)"> | ||
<slot></slot> | ||
</template> | ||
<template v-if="props.layout === 'leftShoulderNavbar'"> | ||
<div class="col-span-2"> | ||
<slot name="navbar"></slot> | ||
</div> | ||
<div class="col-span-2"> | ||
<slot name="header"></slot> | ||
</div> | ||
<div class="col-span-2 lg:col-span-1"> | ||
<slot name="left-shoulder"></slot> | ||
</div> | ||
<div class="col-span-2 lg:col-span-1"> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
<template v-if="props.layout === 'rightShoulderNavbar'"> | ||
<div class="col-span-2"> | ||
<slot name="navbar"></slot> | ||
</div> | ||
<div class="col-span-2"> | ||
<slot name="header"></slot> | ||
</div> | ||
<div class="col-span-2 lg:col-span-1"> | ||
<slot></slot> | ||
</div> | ||
<div class="col-span-2 lg:col-span-1"> | ||
<slot name="right-shoulder"></slot> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have a single template for each layout, it's more redundant but makes it more clear and easier to maintain
There's also two default slots for rightShoulderNavbar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix the double slot. As per the single template, I actually prefer this way at least for "default slot - only" templates.
packages/layout/src/FzLayout.vue
Outdated
res = 'grid-rows-auto' | ||
break; | ||
case 'twoColumns': | ||
res = 'grid-cols-1 grid-rows-[60px_1fr] lg:grid-rows-1 lg:grid-cols-2' | ||
break; | ||
case 'leftShoulder': | ||
res = 'grid-rows-[60px_1fr] grid-cols-1 lg:grid-rows-1 lg:grid-cols-[260px_1fr]' | ||
break; | ||
case 'leftShoulderNavbar': | ||
res = 'grid-rows-[40px_160px_60px_1fr] grid-cols-1 lg:grid-rows-[40px_160px_1fr] lg:grid-cols-[260px_1fr]' | ||
break; | ||
case 'rightShoulderNavbar': | ||
res = 'grid-rows-[40px_160px_60px_1fr] grid-cols-1 lg:grid-rows-[40px_160px_1fr] lg:grid-cols-[1fr_260px]' | ||
break; | ||
case 'squares': | ||
res = 'grid-cols-1 grid-rows-auto sm:grid-cols-2 sm:grid-rows-auto md:grid-cols-3 md:grid-rows-auto auto-rows-[332px]' | ||
break; | ||
default: | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just return those strings. no need for res
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very much prefer functions to have a single exit if possible, except for quick "out" conditions at the very top when needed.
Jira: LIB-1271