Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Mar 2, 2024
1 parent 3f4d2c9 commit 5ac38d2
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 198 deletions.
198 changes: 0 additions & 198 deletions docs/ModConf.md

This file was deleted.

34 changes: 34 additions & 0 deletions docs/ModConf/components/Image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Image API

When you want to use images that stored on your device then you can use the `<Image />` component to access them

## Setup

```js
import { Image } from "@mmrl/ui";
```

## Usage

```js
function App() {
// type is actually not required
return (
<Page>
<Image src="/sdcard/image.png" type="image/png" />
</Page>
);
}
```

## API

| Attr | Required | Type |
| ----------- | -------- | --------- |
| `src` | Yes | `string` |
| `type` | No | `string` |
| `shadow` | No | `number` |
| `title` | No | `string` |
| `noOpen` | No | `boolean` |
| `modFSAdds` | No | `object` |
| `sx` | No | `SxProps` |
72 changes: 72 additions & 0 deletions docs/ModConf/hooks/useActivity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Activity Managment

TODO

## Setup

```js
import { useActivity } from "@mmrl/hooks";
```

## Usage

```js
import React from "react";
import { useActivity } from "@mmrl/hooks";
import { Page, Toolbar } from "@mmrl/ui";
import { Button } from "@mui/material";

function App() {
const { context } = useActivtiy();

const handleOpen = () => {
context.pushPage({
component: NewPage,
// don't forget this!
key: "MyNewPage",
// if your page has props
props: {},
// push any object here
extra: {
title: "Hello",
},
});
};

return (
<Page>
<Button onClick={handleOpen}>Push</Button>
</Page>
);
}

const allowBack = false;

function NewPage() {
// get here your extras
const { context, extra } = useActivtiy();

return (
<Page
// if you want override the back event
onDeviceBackButton={(e) => {
if (allowBack) {
e.callParentHandler();
}
}}
renderToolbar={() => {
return (
<Toolbar>
<Toolbar.Left>
<Toolbar.BackButton onClick={context.popPage} />
</Toolbar.Left>
<Toolbar.Center>{extra.title}</Toolbar.Center>
</Toolbar>
);
}}
>
Hello World
</Page>
);
}
```
Loading

0 comments on commit 5ac38d2

Please sign in to comment.