-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
176 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { StoryObj, Meta } from '@storybook/web-components' | ||
import type { Components } from 'ui-stencil' | ||
import { fn } from '@storybook/test' | ||
|
||
const meta: Meta<Components.OramaChatSuggestions> = { | ||
title: 'Internal/OramaChat', | ||
component: 'orama-chat-suggestions', | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<Components.OramaChatSuggestions> | ||
|
||
export const OramaSuggestions: Story = { | ||
args: { | ||
suggestions: ['How to get started?', 'What are the prices?', 'What is Orama?'], | ||
suggestionClicked: fn(), | ||
}, | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
...ges/ui-stencil/src/components/internal/orama-chat-suggestions/orama-chat-suggestions.scss
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,34 @@ | ||
.suggestions-list { | ||
display: flex; | ||
align-items: center; | ||
column-gap: var(--spacing-s, $spacing-s); | ||
padding: var(--radius-s, $spacing-s) var(--radius-l, $spacing-l); | ||
|
||
list-style: none; | ||
margin: 0; | ||
overflow-x: auto; | ||
|
||
// TODO: check scroll styles | ||
// Maybe move somewhere else to reuse in some somponents, but not globally | ||
&::-webkit-scrollbar { | ||
height: 0em; | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
.suggestion-button { | ||
@include span(); | ||
cursor: pointer; | ||
|
||
border-radius: var(--radius-l, $radius-l); | ||
border: 1px solid var(--border-color-primary, border-color('primary')); | ||
padding: var(--spacing-m, $spacing-m) var(--spacing-m, $spacing-m); | ||
display: flex; | ||
background-color: var(--background-color-primary, background-color('primary')); | ||
width: max-content; | ||
color: var(--text-color-secondary, text-color('secondary')); | ||
|
||
@media (--md-min) { | ||
padding: var(--spacing-xs, $spacing-xs) var(--spacing-m, $spacing-m); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ages/ui-stencil/src/components/internal/orama-chat-suggestions/orama-chat-suggestions.tsx
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,34 @@ | ||
import { Component, h, Prop } from '@stencil/core' | ||
|
||
@Component({ | ||
tag: 'orama-chat-suggestions', | ||
styleUrl: 'orama-chat-suggestions.scss', | ||
}) | ||
export class OramaChatSuggestions { | ||
@Prop() suggestions: string[] | ||
@Prop() suggestionClicked: (suggestion: string) => void | ||
|
||
handleClick(suggestion: string) { | ||
this.suggestionClicked(suggestion) | ||
} | ||
|
||
render() { | ||
if (!this.suggestions?.length) { | ||
return null | ||
} | ||
|
||
return ( | ||
<ul class="suggestions-list"> | ||
{this.suggestions.map((suggestion) => { | ||
return ( | ||
<li key={suggestion} class="suggestion"> | ||
<button type="button" class="suggestion-button" onClick={() => this.handleClick(suggestion)}> | ||
{suggestion} | ||
</button> | ||
</li> | ||
) | ||
})} | ||
</ul> | ||
) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/ui-stencil/src/components/internal/orama-chat-suggestions/readme.md
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,31 @@ | ||
# orama-button | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ------------------- | --------- | ----------- | ------------------------------ | ----------- | | ||
| `suggestionClicked` | -- | | `(suggestion: string) => void` | `undefined` | | ||
| `suggestions` | -- | | `string[]` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Used by | ||
|
||
- [orama-chat](../orama-chat) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
orama-chat --> orama-chat-suggestions | ||
style orama-chat-suggestions fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
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
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
Oops, something went wrong.