-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from LittleDipshit/patch-4
Update docs
- Loading branch information
Showing
7 changed files
with
181 additions
and
49 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
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,51 @@ | ||
# Image API | ||
|
||
Component to display markdown code | ||
|
||
## Setup | ||
|
||
```js | ||
import { Markdown } from "@mmrl/ui"; | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import React from "react" | ||
import { useActivity } from "@mmrl/hooks" | ||
import { Markdown, Page, Toolbar } from "@mmrl/ui"; | ||
|
||
function RenderToolbar() { | ||
const { context, extra } = useActivity() | ||
const { title = "Default" } = extra | ||
return ( | ||
<Toolbar modifier="noshadow"> | ||
<Toolbar.Left> | ||
<Toolbar.BackButton onClick={context.popPage} /> | ||
</Toolbar.Left> | ||
<Toolbar.Center>{title}</Toolbar.Center> | ||
</Toolbar> | ||
) | ||
} | ||
|
||
function App() { | ||
return ( | ||
<Page sx={{ p: 1 }} renderToolbar={RenderToolbar}> | ||
<Markdown>{` | ||
# Heading 1 | ||
Hello, world! | ||
`}</Markdown> | ||
</Page> | ||
); | ||
} | ||
|
||
export default App | ||
``` | ||
|
||
## API | ||
|
||
| Attr | Required | Type | | ||
| ------------- | -------- | ----------------- | | ||
| `children` | Yes | `React.ReactNode` | | ||
| `fetch` | No | `url\|string` | |
File renamed without changes.
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
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,52 @@ | ||
# Config Localization | ||
|
||
## Setup | ||
|
||
```js | ||
import { useStrings } from "@mmrl/hooks" | ||
import { StringsProvider } from "@mmrl/providers" | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import React from "react"; | ||
import { Page, Toolbar } from "@mmrl/ui"; | ||
import { useStrings, useActivity } from "@mmrl/hooks" | ||
import { StringsProvider } from "@mmrl/providers" | ||
|
||
|
||
function RenderToolbar() { | ||
const { context, extra } = useActivity() | ||
const { title = "Default" } = extra | ||
return ( | ||
<Toolbar modifier="noshadow"> | ||
<Toolbar.Left> | ||
<Toolbar.BackButton onClick={context.popPage} /> | ||
</Toolbar.Left> | ||
<Toolbar.Center>{title}</Toolbar.Center> | ||
</Toolbar> | ||
) | ||
} | ||
|
||
function App() { | ||
const { strings } = useStrings() | ||
|
||
return ( | ||
<Page renderToolbar={RenderToolbar}> | ||
{strings("hello")} | ||
</Page> | ||
); | ||
} | ||
|
||
export default () => { | ||
return ( | ||
<StringsProvider data={{ | ||
en: { hello: "Hello" }, | ||
de: { hello: "Hallo" } | ||
}}> | ||
<App /> | ||
</StringsProvider> | ||
) | ||
} | ||
``` |