-
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.
refactor(helper-line): make it possible to show & hide it with a smoo…
…th animation
- Loading branch information
Showing
3 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/components/helper-line/examples/helper-line-animation.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,42 @@ | ||
import { Component, State, h } from '@stencil/core'; | ||
|
||
/** | ||
* Animating the appearance of the helper line | ||
* | ||
* It is possible to hide the helper line component with a | ||
* smooth animation of its height. | ||
* Simply add the `class="hide"` to the component, | ||
* and it will take care fo the animations. | ||
*/ | ||
@Component({ | ||
tag: 'limel-example-helper-line-animation', | ||
shadow: true, | ||
}) | ||
export class HelperLineAnimationExample { | ||
@State() | ||
private hide: boolean = false; | ||
|
||
public render() { | ||
const longHelperText = | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'; | ||
|
||
return [ | ||
<limel-checkbox | ||
label="Hide helper line" | ||
onChange={this.toggleMode} | ||
checked={this.hide} | ||
/>, | ||
<limel-helper-line | ||
class={{ hide: this.hide }} | ||
helperText={longHelperText} | ||
length={10} | ||
maxLength={20} | ||
helperTextId="tf-helper-text" | ||
/>, | ||
]; | ||
} | ||
|
||
private toggleMode = () => { | ||
this.hide = !this.hide; | ||
}; | ||
} |
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