-
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.
add docs about each react component
- Loading branch information
Showing
16 changed files
with
266 additions
and
62 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 |
---|---|---|
@@ -1,7 +1,19 @@ | ||
# Bold | ||
# Bold API | ||
|
||
Mark input text as **bold** | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Bold from "@tlgr/fmt/react/bold"; | ||
// or | ||
import { Bold } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
### children - JSX element or string | ||
| Name | Type | Default | Description | | ||
| -------- | ---- | ------- | ----------------------------- | | ||
| children | node | | The content of the component. | |
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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
# Cash | ||
# Cash API | ||
|
||
## cash(number, opts) | ||
append currency to number | ||
|
||
<small>Added in 1.3.0 </small> | ||
<small>added in 1.5.0</small> | ||
|
||
Mark input number with cash | ||
## Import | ||
|
||
- `number` - <[number][number]> Cash price. | ||
- `opts` - <[Object][object]> format options. | ||
```jsx | ||
import Cash from "@tlgr/fmt/react/cash"; | ||
// or | ||
import { Cash } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
- `locale` - <[string][string]> format locale. Default `en-US`. | ||
- `currency` - <[string][string]> Currency code, e.g. `JPY`, `USD`, `EUR`. Default `USD`. | ||
- `currencyDisplay` - <[string][string]>. Currency display. | ||
- `maximumSignificantDigits` - <[number][number]> maximum digits for not floating part. | ||
- `minimumSignificantDigits` - <[number][number]> minimum digits for not floating part. | ||
- `maximumFractionDigits` - <[number][number]> maximum digits for floating part. | ||
- `minimumFractionDigits` - <[number][number]> maximum digits for floating part. | ||
- `minimumIntegerDigits` - <[number][number]> minimum integer digits. | ||
- `signDisplay` - <[string][string]> sign display. Possible values: `auto` | `never` | `always` | `exceptZero`. | ||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| --------------- | ------ | ------- | -------------------------------- | | ||
| cash | string | | Required. numeric representation | | ||
| locale | string | en-US | Intl.format locale | | ||
| currency | string | USD | Intl.format currency code | | ||
| currencyDisplay | string | $ | Intl.format currency display | | ||
|
||
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#numeric_types | ||
[object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type |
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,21 @@ | ||
# Code API | ||
|
||
Returns code snippet representation | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Code from "@tlgr/fmt/react/code"; | ||
// or | ||
import { Code } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | ------ | ------- | ----------------------------------------------------- | | ||
| children | node | | The content of the component. | | ||
| type | string | inline | Component render type. Can be "inline" or "multiline" | | ||
| lang | string | | language code. E.g. `python`, `py`, `js` | |
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 @@ | ||
# Command API | ||
|
||
Add `/` to command name | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Command from "@tlgr/fmt/react/command"; | ||
// or | ||
import { Command } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| ---- | ------ | ------- | ------------- | | ||
| name | string | | Command name. | |
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,21 @@ | ||
# Email API | ||
|
||
Returns email representation. Example `[email protected]` | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Email from "@tlgr/fmt/react/email"; | ||
// or | ||
import { Eommand } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| ----- | ------ | ------- | ---------------------------------------------------------------------------------------------------- | | ||
| name | string | | Required for domen. Email name with last name. E.g. `fist_last` | | ||
| domen | string | | Required for name. Email domen. E.g. `example.com` | | ||
| email | string | | Required if name and domen is not provided. full email representation. E.g. `[email protected]` | |
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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
# Hash | ||
# Hash API | ||
|
||
## hash(tag) | ||
Add `#` to name | ||
|
||
<small>Added in 1.3.0 </small> | ||
<small>added in 1.5.0</small> | ||
|
||
converts `text` to `#text` | ||
## Import | ||
|
||
- `tag` - <[string][string]> - Tag name. Should be word without spaces. | ||
```jsx | ||
import Hash from "@tlgr/fmt/react/hash"; | ||
// or | ||
import { Hash } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type | ||
## Props | ||
|
||
## hashes(tags) | ||
|
||
<small>Added in 1.3.0 </small> | ||
|
||
apply `hash` function for each tag. | ||
|
||
- `tags` - <[Array][array]> - Tags array. Each tag should be a word without spaces. | ||
|
||
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type | ||
[array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
| Name | Type | Default | Description | | ||
| ---- | ------ | ------- | ----------- | | ||
| hash | string | | Hash name. | |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
# Italic | ||
# Italic API | ||
|
||
Marks text _italic_ | ||
Mark input text as _bold_ | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Italic from "@tlgr/fmt/react/italic"; | ||
// or | ||
import { Italic } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | ---- | ------- | ----------------------------- | | ||
| children | node | | The content of the component. | |
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,20 @@ | ||
# Link API | ||
|
||
return link representation | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Link from "@tlgr/fmt/react/link"; | ||
// or | ||
import { Link } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| ---- | ------------ | ------- | ------------------ | | ||
| url | `URL/string` | | link URL | | ||
| name | `string` | | link display names | |
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 @@ | ||
# Mention API | ||
|
||
return mention to user | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Mention from "@tlgr/fmt/react/mention"; | ||
// or | ||
import { Mention } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | -------- | ------- | ----------------------------------------- | | ||
| username | `string` | | user name which you would like to mention | |
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,23 @@ | ||
# Phone API | ||
|
||
return formatted phone number. | ||
|
||
It uses [`awesome-phonenumber`](https://www.npmjs.com/package/awesome-phonenumber) under the hood. | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Phone from "@tlgr/fmt/react/phone"; | ||
// or | ||
import { Phone } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| ---------- | --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| phone | `string/number` | | phone number | | ||
| format | string | | phone number format | | ||
| regionCode | string | | Region code for the phone number (only required if phoneNumber is on a national format). Example: 'SE' for Sweden, 'CH' for Switzerland, etc. | |
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,21 @@ | ||
# Spoiler API | ||
|
||
return formatted phone number. | ||
|
||
It uses [`awesome-phonenumber`](https://www.npmjs.com/package/awesome-phonenumber) under the hood. | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Spoiler from "@tlgr/fmt/react/spoiler"; | ||
// or | ||
import { Spoiler } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | ---- | ------- | ------------ | | ||
| children | node | | spoiler text | |
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
# Strikethrough | ||
# Strikethrough API | ||
|
||
Marks text as <s>strikethrough</s> | ||
return <s>strikethrough</s> text | ||
|
||
## strikethrough(text) | ||
<small>added in 1.5.0</small> | ||
|
||
<small>Added in 1.3.0</small> | ||
## Import | ||
|
||
## returns | ||
```jsx | ||
import Strikethrough from "@tlgr/fmt/react/strikethrough"; | ||
// or | ||
import { Strikethrough } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
decorated text | ||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | ---- | ------- | -------------- | | ||
| children | node | | component text | |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
# Underline | ||
# Underline API | ||
|
||
Marks text as <u>underline</u> | ||
returns <u>Underline</u> text | ||
|
||
<small>added in 1.5.0</small> | ||
|
||
## Import | ||
|
||
```jsx | ||
import Underline from "@tlgr/fmt/react/underline"; | ||
// or | ||
import { Underline } from "@tlgr/fmt/react"; | ||
``` | ||
|
||
## Props | ||
|
||
| Name | Type | Default | Description | | ||
| -------- | ---- | ------- | -------------- | | ||
| children | node | | component text | |
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import { h } from 'preact'; | ||
|
||
export default function (url: string | URL, name?: string) { | ||
const link = url.toString(); | ||
return <a href={link}>{name ?? link}</a> | ||
type Props = { | ||
url: string | URL; | ||
name?: string; | ||
} | ||
|
||
/** | ||
* Returns HTML link representation | ||
*/ | ||
export default function (props: Props) { | ||
const link = props.url.toString(); | ||
return <a href={link}>{props.name ?? link}</a> | ||
} |