-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
NextQueryPreview
carousel in results grid (#158)
- Loading branch information
Showing
9 changed files
with
35,012 additions
and
4,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<NextQueryPreview | ||
#default="{ results, totalResults, suggestion }" | ||
class="x-list x-background--neutral-95 x-list--gap-06 x-padding--06" | ||
:suggestion="nextQuery" | ||
> | ||
<span class="x-title2 x-font-weight--bold">{{ $t('nextQueryPreview.title') }}</span> | ||
<div class="x-list x-list--horizontal x-list--align-center x-list--gap-03"> | ||
<span class="x-title3 x-font-weight--bold"> | ||
{{ | ||
$t('nextQueryPreview.query', { | ||
query: suggestion.query | ||
}) | ||
}} | ||
</span> | ||
<span class="x-text"> | ||
{{ | ||
$t('nextQueryPreview.totalResults', { | ||
totalResults: totalResults | ||
}) | ||
}} | ||
</span> | ||
</div> | ||
<BaseGrid | ||
#default="{ item }" | ||
:columns="maxItemsToRender" | ||
:items="results.slice(0, maxItemsToRender)" | ||
class="x-padding--00" | ||
> | ||
<Result :result="item" /> | ||
</BaseGrid> | ||
<NextQuery | ||
:suggestion="nextQuery" | ||
class=" | ||
x-tag x-tag--pill | ||
x-font-weight--bold | ||
x-margin--left-auto x-margin--right-auto | ||
x-padding--top-04 x-padding--bottom-04 x-padding--right-05 x-padding--left-05 | ||
x-font-color--lead | ||
x-border-color--lead | ||
" | ||
> | ||
{{ $t('nextQueryPreview.viewResults', { totalResults }) }} | ||
</NextQuery> | ||
</NextQueryPreview> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Prop, Vue } from 'vue-property-decorator'; | ||
import { BaseGrid } from '@empathyco/x-components'; | ||
import { NextQuery, NextQueryPreview } from '@empathyco/x-components/next-queries'; | ||
import { NextQuery as NextQueryModel } from '@empathyco/x-types'; | ||
import Result from '../results/result.vue'; | ||
@Component({ | ||
components: { | ||
BaseGrid, | ||
NextQuery, | ||
NextQueryPreview, | ||
Result | ||
} | ||
}) | ||
export default class DesktopNextQueryPreview extends Vue { | ||
// TODO: Remove this and configure NextQueryPreview after doing EX-6819. | ||
@Prop({ default: 4 }) | ||
protected maxItemsToRender!: number; | ||
@Prop({ required: true }) | ||
protected nextQuery!: NextQueryModel; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<template> | ||
<NextQueryPreview | ||
#default="{ results, totalResults, suggestion }" | ||
class=" | ||
x-list x-list--gap-05 | ||
x-background--neutral-95 | ||
x-padding--top-06 x-padding--bottom-06 | ||
x-margin--top-10 x-margin--bottom-05 | ||
" | ||
:suggestion="nextQuery" | ||
> | ||
<span class="x-next-query-preview__title x-title2 x-font-weight--bold"> | ||
{{ $t('nextQueryPreview.title') }} | ||
</span> | ||
<div class="x-next-query-preview__header x-list x-list--horizontal x-list--align-center"> | ||
<div class="x-list x-list--horizontal x-list--align-baseline x-list--gap-02"> | ||
<span class="x-title3 x-font-weight--bold"> | ||
{{ | ||
$t('nextQueryPreview.query', { | ||
query: suggestion.query | ||
}) | ||
}} | ||
</span> | ||
<span class="x-text x-font-size--04"> | ||
{{ | ||
$t('nextQueryPreview.totalResults', { | ||
totalResults: totalResults | ||
}) | ||
}} | ||
</span> | ||
</div> | ||
<NextQuery | ||
:suggestion="nextQuery" | ||
class="x-button x-button--ghost x-padding--00 x-margin--left-auto x-font-weight--bold" | ||
> | ||
{{ $t('nextQueryPreview.viewResults') }} | ||
</NextQuery> | ||
</div> | ||
<SlidingPanel | ||
class="x-background--neutral-95" | ||
:showButtons="false" | ||
:resetOnContentChange="false" | ||
> | ||
<div class="x-list x-list--gap-05"> | ||
<Result | ||
v-for="result in results" | ||
:key="result.id" | ||
:result="result" | ||
class="x-next-query-preview__result" | ||
/> | ||
</div> | ||
</SlidingPanel> | ||
</NextQueryPreview> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Prop, Vue } from 'vue-property-decorator'; | ||
import { SlidingPanel } from '@empathyco/x-components'; | ||
import { NextQuery, NextQueryPreview } from '@empathyco/x-components/next-queries'; | ||
import { NextQuery as NextQueryModel } from '@empathyco/x-types'; | ||
import Result from '../results/result.vue'; | ||
@Component({ | ||
components: { | ||
NextQuery, | ||
NextQueryPreview, | ||
Result, | ||
SlidingPanel | ||
} | ||
}) | ||
export default class MobileNextQueryPreview extends Vue { | ||
@Prop({ required: true }) | ||
protected nextQuery!: NextQueryModel; | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.x-mobile { | ||
.x-next-query-preview { | ||
margin-inline: calc(-1 * var(--x-size-padding-grid)); | ||
&__title { | ||
padding-inline: var(--x-size-padding-grid); | ||
} | ||
&__header { | ||
padding-inline: var(--x-size-padding-grid); | ||
} | ||
&__result { | ||
width: calc(38vw - var(--x-size-gap-list-05)); | ||
} | ||
.x-sliding-panel__scroll { | ||
padding-left: var(--x-size-padding-grid); | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters