Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe('FileBrowserView group references', () => {

describe('FileBrowserView details layout', () => {
// The side-by-side grid of the wide layout, as the view class names it.
const SIDE_BY_SIDE = 'lg:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]'
const SIDE_BY_SIDE = 'large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]'

// The view starts with a comment, so its root is a fragment: the grid is found inside the page container of MdPage.
const layoutGrid = (wrapper: VueWrapper) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ const toggleCompactMode = () => {
-->
<MdPage spaced>
<div
class="grid min-h-[320px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(320px,400px)] lg:items-start"
class="grid min-h-[320px] grid-cols-[minmax(0,1fr)] gap-6 large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)] large:items-start"
data-ingot-component="file-browser-view"
>
<div class="min-w-0 lg:col-start-2 lg:row-start-1">
<div class="min-w-0 large:col-start-2 large:row-start-1">
<Card
:qualifier="qualifier"
:listing="listedNames"
Expand Down
2 changes: 1 addition & 1 deletion reposilite-frontend/src/components/browser/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const uploadFiles = () => {
<MdCard
v-if="stubPomEnabled"
variant="low"
class="mt-3 grid gap-3 sm:grid-cols-3"
class="mt-3 grid gap-3 medium:grid-cols-3"
data-test="stub-pom"
>
<MdTextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ describe('InstanceStatusPanel', () => {
wrapper.unmount()
})

it('steps the tile grids up on the MD3 window classes, not on default Tailwind breakpoints', async () => {
session.client = ref(clientWith(() => Promise.resolve({ data: { ...INSTANCE } })))
const wrapper = mount(InstanceStatusPanel)
await flushPromises()

const grids = wrapper.findAll('.grid.grid-cols-2')
expect(grids.length, 'the panel draws its tile grids').toBeGreaterThan(0)
for (const grid of grids) {
expect(grid.classes(), 'three columns from the expanded window class').toContain('expanded:grid-cols-3')
expect(grid.classes().filter(name => /^(sm|md|lg|xl):/.test(name)), 'no default Tailwind breakpoint').toEqual([])
}
wrapper.unmount()
})

it('opens the failures sheet from the failures tile when failures are recorded', async () => {
const failure: Failure = {
id: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const readOnlyScope = computed(() => {
role="status"
aria-busy="true"
aria-label="Loading instance status"
class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5"
class="grid grid-cols-2 gap-3 expanded:grid-cols-3 large:grid-cols-5"
data-ingot-component="instance-status-panel"
>
<MdCard
Expand Down Expand Up @@ -320,7 +320,7 @@ const readOnlyScope = computed(() => {
</p>
</MdAlert>

<div class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6">
<div class="grid grid-cols-2 gap-3 expanded:grid-cols-3 large:grid-cols-6">
<StatTile
data-testid="read-only-card"
label="Read-only mode"
Expand All @@ -339,7 +339,7 @@ const readOnlyScope = computed(() => {

<div
v-if="!clusterView"
class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5"
class="grid grid-cols-2 gap-3 expanded:grid-cols-3 large:grid-cols-5"
>
<StatTile
label="Used memory"
Expand Down Expand Up @@ -395,7 +395,7 @@ const readOnlyScope = computed(() => {
<div
data-testid="cluster-summary"
data-ingot-part="cluster-summary"
class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6"
class="grid grid-cols-2 gap-3 expanded:grid-cols-3 large:grid-cols-6"
>
<StatTile
label="Cluster memory"
Expand Down
11 changes: 11 additions & 0 deletions reposilite-frontend/src/components/header/HeaderHero.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ describe('HeaderHero', () => {
})
})

describe('HeaderHero window classes', () => {
it('lays the logo beside the text from the expanded window class', () => {
const classes = mount(HeaderHero).find('img').element.parentElement!.className.split(/\s+/)

expect(classes, 'a row from the expanded window class').toContain('expanded:flex-row')
expect(classes, 'the narrow padding below the medium window class').toContain('max-medium:py-6')
expect(classes, 'no default Tailwind breakpoint').not.toContain('md:flex-row')
expect(classes, 'no default Tailwind max breakpoint').not.toContain('max-sm:py-6')
})
})

describe('HeaderHero logo', () => {
const logoSource = (wrapper: VueWrapper<InstanceType<typeof HeaderHero>>) => wrapper.find('img').attributes('src')

Expand Down
6 changes: 3 additions & 3 deletions reposilite-frontend/src/components/header/HeaderHero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ const logo = computed(() => logoFor(appearance, organizationLogo, theme.isDark))
-->
<MdPage
centred
class="max-w-none flex flex-col items-center gap-6 py-10 md:flex-row md:items-center md:gap-10 max-sm:py-6"
class="max-w-none flex flex-col items-center gap-6 py-10 expanded:flex-row expanded:items-center expanded:gap-10 max-medium:py-6"
>
<img
class="size-32 shrink-0 rounded-corner-full border-2 border-outline-variant md:size-40"
class="size-32 shrink-0 rounded-corner-full border-2 border-outline-variant expanded:size-40"
alt=""
:src="logo"
>
<div class="flex min-w-0 flex-col items-center gap-3 text-center md:items-start md:text-left">
<div class="flex min-w-0 flex-col items-center gap-3 text-center expanded:items-start expanded:text-left">
<!-- eslint-disable vue/no-v-html -- the description is markup the operator sets in the instance settings, a trusted constant of the deployment -->
<div
class="md-title-large text-on-surface"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,16 @@ describe('RepositoryOverview layout order', () => {

const [first, second] = (wrapper.element as HTMLElement).firstElementChild?.children ?? []
expect(first.tagName, 'the list is the first block, so a narrow screen shows it first').toBe('SECTION')
expect(second.className, 'the snippet card follows the list').toContain('lg:col-start-2')
expect(second.className, 'the snippet card follows the list').toContain('large:col-start-2')
})
})

describe('RepositoryOverview width', () => {
it('keeps the list and the snippet card side by side from 1024 pixels, as before', async () => {
it('keeps the list and the snippet card side by side from the large window class (1240 pixels)', async () => {
await mountAt('/')

expect((wrapper.element as HTMLElement).firstElementChild?.className, 'the card keeps its column on the right from 1024 pixels').toContain(
'min-[1024px]:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]'
expect((wrapper.element as HTMLElement).firstElementChild?.className, 'the card keeps its column on the right from 840 pixels').toContain(
'large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]'
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const setShowDetails = (value: boolean) => {
spaced
>
<div
class="grid min-h-[320px] grid-cols-[minmax(0,1fr)] gap-6 min-[1024px]:grid-cols-[minmax(0,1fr)_minmax(320px,400px)] lg:items-start"
class="grid min-h-[320px] grid-cols-[minmax(0,1fr)] gap-6 large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)] large:items-start"
data-ingot-component="repository-overview"
>
<!-- The list comes first in reading order. From 1024px the card keeps its column on the right, and below it follows the list. -->
Expand Down Expand Up @@ -545,7 +545,7 @@ const setShowDetails = (value: boolean) => {
</div>
</section>

<div class="min-w-0 lg:col-start-2 lg:row-start-1">
<div class="min-w-0 large:col-start-2 large:row-start-1">
<Card :qualifier="qualifier" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion reposilite-frontend/src/components/plugins/PluginBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ if (props.block?.type === 'keyValue' || props.block?.type === 'table') {

<div
v-else-if="block.type === 'filter'"
class="flex flex-col gap-3 sm:flex-row sm:flex-wrap"
class="flex flex-col gap-3 medium:flex-row medium:flex-wrap"
>
<template
v-for="(control, index) in controls"
Expand Down
4 changes: 2 additions & 2 deletions reposilite-frontend/src/components/search/SearchResultRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const sourceOf = (file: SearchFile) => (file.origin === 'MIRROR'
data-test="result"
data-ingot-component="search-result-row"
>
<div class="flex items-start gap-2 px-2 py-3 sm:px-4">
<div class="flex items-start gap-2 px-2 py-3 medium:px-4">
<div class="flex min-w-0 flex-1 flex-col gap-2">
<button
:id="titleId"
Expand Down Expand Up @@ -166,7 +166,7 @@ const sourceOf = (file: SearchFile) => (file.origin === 'MIRROR'
:id="regionId"
role="region"
:aria-labelledby="titleId"
class="bg-surface-container-low px-4 py-2 sm:pl-14"
class="bg-surface-container-low px-4 py-2 medium:pl-14"
data-test="files"
>
<p
Expand Down
10 changes: 10 additions & 0 deletions reposilite-frontend/src/components/search/SearchView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ describe('SearchView page shell', () => {
})
})

describe('SearchView window classes', () => {
it('puts the filters beside the results from the large window class', async () => {
await mountAt('/search')

const grid = wrapper.find('.grid')
expect(grid.classes(), 'two columns from the large window class').toContain('large:grid-cols-[minmax(240px,300px)_minmax(0,1fr)]')
expect(grid.classes(), 'no default Tailwind breakpoint').not.toContain('lg:grid-cols-[minmax(240px,300px)_minmax(0,1fr)]')
})
})

describe('SearchView request and address', () => {
it('builds the request from the address', async () => {
const client = await mountAt('/search?q=commons&origin=mirror&extension=jar&extension=pom&sort=size&order=desc&page=2')
Expand Down
12 changes: 6 additions & 6 deletions reposilite-frontend/src/components/search/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,17 @@ const toggleRow = (item: SearchItem) => {
Some repositories are hidden from visitors who are not signed in. Sign in to see more results.
</p>

<div class="mt-6 grid grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(240px,300px)_minmax(0,1fr)] lg:items-start">
<div class="mt-6 grid grid-cols-[minmax(0,1fr)] gap-6 large:grid-cols-[minmax(240px,300px)_minmax(0,1fr)] large:items-start">
<!-- Below 1024px the filters are a modal sheet; from there on they are a column beside the results. -->
<div
:class="sheetOpen ? 'fixed inset-0 z-40 flex flex-col bg-surface lg:static lg:z-auto lg:bg-transparent' : 'hidden lg:block'"
:class="sheetOpen ? 'fixed inset-0 z-40 flex flex-col bg-surface large:static large:z-auto large:bg-transparent' : 'hidden large:block'"
:role="sheetOpen ? 'dialog' : undefined"
:aria-modal="sheetOpen ? 'true' : undefined"
:aria-labelledby="filtersTitleId"
data-test="filter-panel"
@keydown.esc="toggleSheet(false)"
>
<div class="flex items-center justify-between px-4 pt-4 lg:hidden">
<div class="flex items-center justify-between px-4 pt-4 large:hidden">
<h2
:id="filtersTitleId"
class="md-title-large text-on-surface"
Expand All @@ -373,7 +373,7 @@ const toggleRow = (item: SearchItem) => {
>
Filters
</h2>
<div class="flex-1 overflow-y-auto p-4 lg:overflow-visible lg:p-0">
<div class="flex-1 overflow-y-auto p-4 large:overflow-visible large:p-0">
<SearchFilters
:query="query"
:facets="facets"
Expand All @@ -383,7 +383,7 @@ const toggleRow = (item: SearchItem) => {
@reset="reset"
/>
</div>
<div class="p-4 lg:hidden">
<div class="p-4 large:hidden">
<MdButton
variant="filled"
class="w-full"
Expand Down Expand Up @@ -418,7 +418,7 @@ const toggleRow = (item: SearchItem) => {
<MdButton
ref="filterButton"
variant="outlined"
class="lg:hidden"
class="large:hidden"
aria-haspopup="dialog"
:aria-expanded="String(sheetOpen)"
data-test="open-filters"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"file": "src/components/browser/FileBrowserView.vue",
"match": "lg:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]",
"match": "large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]",
"count": 1
},
{
Expand Down Expand Up @@ -211,7 +211,7 @@
},
{
"file": "src/components/overview/RepositoryOverview.vue",
"match": "min-[1024px]:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]",
"match": "large:grid-cols-[minmax(0,1fr)_minmax(320px,400px)]",
"count": 1
},
{
Expand All @@ -236,7 +236,7 @@
},
{
"file": "src/components/search/SearchView.vue",
"match": "lg:grid-cols-[minmax(240px,300px)_minmax(0,1fr)]",
"match": "large:grid-cols-[minmax(240px,300px)_minmax(0,1fr)]",
"count": 1
},
{
Expand Down
Loading