Skip to content

Commit

Permalink
feat(cisa): style images (algolia#6033)
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-giraudet authored Feb 5, 2024
1 parent 0dbeb82 commit 1fc011e
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,15 @@ exports[`Templates InstantSearch.js File content: src/app.css 1`] = `
#pagination {
margin: 2rem auto;
text-align: center;
}
.ais-Hits-item article {
display: flex;
}
.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}"
`;
Expand All @@ -2577,8 +2586,10 @@ search.addWidgets([
item: (hit, { html, components }) => html\`
<article>
<img src=\${hit.imageAttribute} alt=\${hit.attribute1} />
<h1>\${components.Highlight({ hit, attribute: 'attribute1' })}</h1>
<p>\${components.Highlight({ hit, attribute: 'attribute2' })}</p>
<div>
<h1>\${components.Highlight({ hit, attribute: 'attribute1' })}</h1>
<p>\${components.Highlight({ hit, attribute: 'attribute2' })}</p>
</div>
</article>
\`,
},
Expand Down Expand Up @@ -4159,6 +4170,15 @@ exports[`Templates JavaScript Client File content: src/app.css 1`] = `
margin-bottom: 1rem;
}
.ais-hits--item article {
display: flex;
}
.ais-hits--item img {
max-height: 125px;
padding-right: 16px;
}
#searchBox {
margin-bottom: 2rem;
}"
Expand All @@ -4184,8 +4204,10 @@ function renderHits(query) {
\`<li class=\\"ais-hits--item\\">
<article>
<img src=\\"\${hit.imageAttribute}\\" alt=\\"\${hit.attribute1}\\" />
<h1>\${hit._highlightResult.attribute1.value}</h1>
<p>\${hit._highlightResult.attribute2.value}</p>
<div>
<h1>\${hit._highlightResult.attribute1.value}</h1>
<p>\${hit._highlightResult.attribute2.value}</p>
</div>
</article>
</li>\`
)
Expand Down Expand Up @@ -4468,6 +4490,15 @@ exports[`Templates JavaScript Helper File content: src/app.css 1`] = `
margin-bottom: 1rem;
}
.ais-hits--item article {
display: flex;
}
.ais-hits--item img {
max-height: 125px;
padding-right: 16px;
}
#searchBox {
margin-bottom: 2rem;
}"
Expand Down Expand Up @@ -4499,8 +4530,10 @@ helper.on('result', ({ results }) => {
\`<li class=\\"ais-hits--item\\">
<article>
<img src=\\"\${hit.imageAttribute}\\" alt=\\"\${hit.attribute1}\\" />
<h1>\${hit._highlightResult.attribute1.value}</h1>
<p>\${hit._highlightResult.attribute2.value}</p>
<div>
<h1>\${hit._highlightResult.attribute1.value}</h1>
<p>\${hit._highlightResult.attribute2.value}</p>
</div>
</article>
</li>\`
)
Expand Down Expand Up @@ -4729,6 +4762,15 @@ em {
.pagination {
margin: 2rem auto;
text-align: center;
}
.ais-Hits-item article {
display: flex;
}
.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}"
`;
Expand Down Expand Up @@ -4817,12 +4859,14 @@ function Hit({ hit }: HitProps) {
return (
<article>
<img src={hit.imageAttribute} alt={hit.attribute1} />
<h1>
<Highlight attribute=\\"attribute1\\" hit={hit} />
</h1>
<p>
<Highlight attribute=\\"attribute2\\" hit={hit} />
</p>
<div>
<h1>
<Highlight attribute=\\"attribute1\\" hit={hit} />
</h1>
<p>
<Highlight attribute=\\"attribute2\\" hit={hit} />
</p>
</div>
</article>
);
}"
Expand Down Expand Up @@ -5509,12 +5553,14 @@ exports[`Templates Vue InstantSearch File content: src/App.vue 1`] = `
<template slot=\\"item\\" slot-scope=\\"{ item }\\">
<article>
<img :src=\\"item.imageAttribute\\" :alt=\\"item.attribute1\\" />
<h1>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute1\\" />
</h1>
<p>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute2\\" />
</p>
<div>
<h1>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute1\\" />
</h1>
<p>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute2\\" />
</p>
</div>
</article>
</template>
</ais-hits>
Expand Down Expand Up @@ -5613,6 +5659,15 @@ em {
margin: 2rem auto;
text-align: center;
}
.ais-Hits-item article {
display: flex;
}
.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}
</style>"
`;
Expand Down Expand Up @@ -5805,12 +5860,14 @@ exports[`Templates Vue InstantSearch with Vue 3 File content: src/App.vue 1`] =
<template v-slot:item=\\"{ item }\\">
<article>
<img :src=\\"item.imageAttribute\\" :alt=\\"item.attribute1\\" />
<h1>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute1\\" />
</h1>
<p>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute2\\" />
</p>
<div>
<h1>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute1\\" />
</h1>
<p>
<ais-highlight :hit=\\"item\\" attribute=\\"attribute2\\" />
</p>
</div>
</article>
</template>
</ais-hits>
Expand Down Expand Up @@ -5914,6 +5971,15 @@ em {
margin: 2rem auto;
text-align: center;
}
.ais-Hits-item article {
display: flex;
}
.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}
</style>"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,12 @@
margin: 2rem auto;
text-align: center;
}

.ais-Hits-item article {
display: flex;
}

.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ search.addWidgets([
{{#if imageAttribute}}
<img src=${ hit.{{imageAttribute}} } alt=${ hit.{{attributesToDisplay.[0]}} } />
{{/if}}
<h1>${components.Highlight({hit, attribute: "{{attributesToDisplay.[0]}}"})}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${components.Highlight({hit, attribute: "{{this}}"})}</p>
{{/unless}}
{{/each}}
<div>
<h1>${components.Highlight({hit, attribute: "{{attributesToDisplay.[0]}}"})}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${components.Highlight({hit, attribute: "{{this}}"})}</p>
{{/unless}}
{{/each}}
</div>
</article>
`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ em {
margin-bottom: 1rem;
}

.ais-hits--item article {
display: flex;
}

.ais-hits--item img {
max-height: 125px;
padding-right: 16px;
}

#searchBox {
margin-bottom: 2rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ function renderHits(query) {
{{#if imageAttribute}}
<img src="${ hit.{{imageAttribute}} }" alt="${ hit.{{attributesToDisplay.[0]}} }" />
{{/if}}
<h1>${hit._highlightResult.{{attributesToDisplay.[0]}}.value}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${hit._highlightResult.{{this}}.value}</p>
{{/unless}}
{{/each}}
<div>
<h1>${hit._highlightResult.{{attributesToDisplay.[0]}}.value}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${hit._highlightResult.{{this}}.value}</p>
{{/unless}}
{{/each}}
</div>
{{else}}
<p>
<code>${JSON.stringify(hit).slice(0, 100)}...</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ em {
margin-bottom: 1rem;
}

.ais-hits--item article {
display: flex;
}

.ais-hits--item img {
max-height: 125px;
padding-right: 16px;
}

#searchBox {
margin-bottom: 2rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ helper.on('result', ({ results }) => {
{{#if imageAttribute}}
<img src="${ hit.{{imageAttribute}} }" alt="${ hit.{{attributesToDisplay.[0]}} }" />
{{/if}}
<h1>${hit._highlightResult.{{attributesToDisplay.[0]}}.value}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${hit._highlightResult.{{this}}.value}</p>
{{/unless}}
{{/each}}
<div>
<h1>${hit._highlightResult.{{attributesToDisplay.[0]}}.value}</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>${hit._highlightResult.{{this}}.value}</p>
{{/unless}}
{{/each}}
</div>
{{else}}
<p>
<code>${JSON.stringify(hit).slice(0, 100)}...</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,12 @@ em {
margin: 2rem auto;
text-align: center;
}

.ais-Hits-item article {
display: flex;
}

.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,18 @@ function Hit({ hit }: HitProps) {
{{#if imageAttribute}}
<img src={ hit.{{imageAttribute}} } alt={ hit.{{attributesToDisplay.[0]}} } />
{{/if}}
<h1>
<Highlight attribute="{{attributesToDisplay.[0]}}" hit={hit} />
</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>
<Highlight attribute="{{this}}" hit={hit} />
</p>
{{/unless}}
{{/each}}
<div>
<h1>
<Highlight attribute="{{attributesToDisplay.[0]}}" hit={hit} />
</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>
<Highlight attribute="{{this}}" hit={hit} />
</p>
{{/unless}}
{{/each}}
</div>
{{else}}
<p>
<code>{JSON.stringify(hit).slice(0, 100)}...</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@
{{#if imageAttribute}}
<img :src="item.{{imageAttribute}}" :alt="item.{{attributesToDisplay.[0]}}" />
{{/if}}
<h1>
<ais-highlight
:hit="item"
attribute="{{attributesToDisplay.[0]}}"
/>
</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>
<ais-highlight :hit="item" attribute="{{this}}" />
</p>
{{/unless}}
{{/each}}
<div>
<h1>
<ais-highlight
:hit="item"
attribute="{{attributesToDisplay.[0]}}"
/>
</h1>
{{#each attributesToDisplay}}
{{#unless @first}}
<p>
<ais-highlight :hit="item" attribute="{{this}}" />
</p>
{{/unless}}
{{/each}}
</div>
</article>
</template>
</ais-hits>
Expand Down Expand Up @@ -171,4 +173,13 @@ em {
margin: 2rem auto;
text-align: center;
}
.ais-Hits-item article {
display: flex;
}
.ais-Hits-item img {
max-height: 125px;
padding-right: 16px;
}
</style>
Loading

0 comments on commit 1fc011e

Please sign in to comment.