Skip to content

Commit

Permalink
feat: version bump v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Mar 30, 2023
1 parent ec0b028 commit ac24301
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,28 @@ timezones={{

## 🎨 Custom Select component

By default, react-timezone-select uses [`react-select`](https://github.com/jedwatson/react-select) as underlying select
component.
If your application already uses another select component i.e. MUI, Semantic UI or similar you can use
the `useTimezoneSelect` hook instead of the `TimezoneSelect` component to render the timezones using your self-provided
select component.
By default, `react-timezone-select` uses [`react-select`](https://github.com/jedwatson/react-select) as underlying select component. If you'd like to bring your own select component, you can use the `useTimezoneSelect` hook instead of the `TimezoneSelect` component to render the timezones using your self-provided select component.

```jsx
import { useTimezoneSelect } from 'react-timezone-select'

const { options, parseTimezone } = useTimezoneSelect({ labelStyle, timezones })
return (
<select onChange={e => onChange(parseTimezone(e.currentTarget.value))}>
{options.map(option => (
<option value={option.value}>{option.label}</option>
))}
</select>
)
import { useTimezoneSelect, allTimezones } from 'react-timezone-select'

const labelStyle = 'original'
const timezones = {
...allTimezones,
'Europe/Berlin': 'Frankfurt'
}

const customSelect = () => {
const { options, parseTimezone } = useTimezoneSelect({ labelStyle, timezones })

return (
<select onChange={e => onChange(parseTimezone(e.currentTarget.value))}>
{options.map(option => (
<option value={option.value}>{option.label}</option>
))}
</select>
)
}
```

## 🚧 Contributing
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-timezone-select",
"version": "2.0.1",
"version": "2.1.0",
"description": "Usable, dynamic React Timezone Select",
"scripts": {
"dev": "concurrently \"tsup src/index.tsx --format esm --watch\" \"cd example && pnpm dev\"",
Expand Down

0 comments on commit ac24301

Please sign in to comment.