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/lib 1271 fzlayout #174

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Feat/lib 1271 fzlayout #174

wants to merge 10 commits into from

Conversation

Trebh
Copy link
Collaborator

@Trebh Trebh commented Nov 6, 2024

Jira: LIB-1271

@Trebh Trebh self-assigned this Nov 6, 2024
})

expect(wrapper.html()).toMatchSnapshot()
})
Copy link
Collaborator

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

Comment on lines 3 to 32
<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>
Copy link
Member

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

Copy link
Collaborator Author

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.

Comment on lines 49 to 67
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;
Copy link
Member

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

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants