Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Add the hideNow prop to the time picker (#331)
Browse files Browse the repository at this point in the history
Co-authored-by: Lev Chelyadinov <[email protected]>
  • Loading branch information
CuriousCI and illright authored Dec 30, 2021
1 parent 177813e commit c4114cc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Added

- The `hideNow` prop to the `TimePicker` component has been added to hide the `now` button (Thanks to [@CuriousCI](https://github.com/CuriousCI) for the contribution - [#331](https://github.com/illright/attractions/pull/331)).

## [3.6.0] - 2021-11-08

### Changed
Expand Down
19 changes: 13 additions & 6 deletions attractions/time-picker/time-picker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
*/
export let inputClass = null;
/**
* Hides the `now` button from the component.
* @type {boolean}
*/
export let hideNow = false;
/**
* Aligns the dropdown content such that it opens to the top of the text field, extending up.
* @type {boolean}
Expand Down Expand Up @@ -267,12 +272,14 @@
/>
</div>
{/if}
<Button on:click={setToNow}>
<slot name="now-icon">
<Clock />
</slot>
<slot name="now-label">now</slot>
</Button>
{#if !hideNow}
<Button on:click={setToNow}>
<slot name="now-icon">
<Clock />
</slot>
<slot name="now-label">now</slot>
</Button>
{/if}
</Dropdown>
</DropdownShell>
</div>
Expand Down
3 changes: 3 additions & 0 deletions docs/src/routes/docs/components/time-picker.svx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ A time picker that supports both the text input and a dropdown with buttons.
<div slot="showcase" class="padded">
<TimePicker right />
<TimePicker format="%H.%M.%S %P" />
<TimePicker hideNow />
</div>
<div slot="source">

```svelte
<TimePicker right />
<TimePicker format="%H.%M.%S %P" />
<TimePicker hideNow />
```

</div>
Expand All @@ -42,6 +44,7 @@ A time picker that supports both the text input and a dropdown with buttons.

| Name | Default | Type | Description |
| ---- | ------- | ---- | ----------- |
| **`hideNow`** | `false` | `boolean` | Hides the `now` button from the component. |
| **`right`** | `false` | `boolean` | Aligns the dropdown with the right edge of the text field. |
| **`top`** | `false` | `boolean` | Aligns the dropdown content such that it opens to the top of the text field, extending up. |

Expand Down

0 comments on commit c4114cc

Please sign in to comment.