-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(popover): make a new example for styling
- Loading branch information
Showing
6 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
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,5 @@ | ||
limel-popover { | ||
--popover-border-radius: 0.95rem; | ||
--popover-body-background-color: transparent; | ||
--popover-box-shadow: var(--shadow-depth-8); | ||
} |
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,53 @@ | ||
import { Component, h, State } from '@stencil/core'; | ||
|
||
/** | ||
* Styling | ||
* There are a few custom CSS properties that you can use to style the popover. | ||
*/ | ||
|
||
@Component({ | ||
tag: 'limel-example-popover-styling', | ||
shadow: true, | ||
styleUrl: 'popover-styling.scss', | ||
}) | ||
export class PopoverStylingExample { | ||
@State() | ||
private isOpen = false; | ||
|
||
public render() { | ||
const image = { | ||
src: 'https://unsplash.it/800/800/?random', | ||
alt: 'Some random image', | ||
}; | ||
|
||
return [ | ||
<limel-popover open={this.isOpen} onClose={this.onPopoverClose}> | ||
<limel-button | ||
slot="trigger" | ||
label="Click me!" | ||
onClick={this.openPopover} | ||
/> | ||
<limel-card | ||
style={{ 'max-width': '20rem' }} | ||
orientation="landscape" | ||
image={image} | ||
heading="Heading" | ||
subheading="Subheading" | ||
value="This is the body of the card." | ||
/> | ||
</limel-popover>, | ||
]; | ||
} | ||
|
||
private openPopover = (event: MouseEvent) => { | ||
event.stopPropagation(); | ||
console.log('opening'); | ||
this.isOpen = true; | ||
}; | ||
|
||
private onPopoverClose = (event: CustomEvent) => { | ||
event.stopPropagation(); | ||
console.log('closing'); | ||
this.isOpen = false; | ||
}; | ||
} |
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