Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PARNTER-108] Add README for wallet docs #180

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions docs/building-apps/wallet/_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
## Contributing guide

Thank you for contributing to the Stellar Wallet documentation! To get started,
please first read [main README](../../../README.md) guide.

This documentation is mainly for the Wallet SDK and it's usages to integrate
with various SEPs.

The document is structured to be language-agnostic, but with the components
listed below we can add language-specific logic into the document.

Generally, text should be applicable to all of supported programming languages,
but for differences special `<LanguageSpecific/>` component can be used (read
more below)

### Wallet guide components

#### Header

Header is a special .mdx file that should be included on all pages. It contains:

- Language buttons
- A general guide on using this buttons
- Optional warning for languages in progress

On all new pages, Header should be the first element. Optionally, provide list
of languages that are work in progress:

```mdxjs
<Header WIPLangs={["ts", "dart"]}/>
```

#### LanguageButtons

This component is a part of the header. It allows to switch between programming
languages. Current language is stored as a cookie.

#### WalletGuideWarn

This component puts a warning if language is in progress for this section.
Please use `WIPLangs` property to enable it for a language for the page.

#### WalletCodeExample

This is improved `CodeExample` component. It currently supports dynamic
switching between TypeScript, Kotlin and Flutter code snippets (depending on the
user selected language). It will also generate placeholder if code snippet is
missing. Here's an example on how to use it:

````mdxjs
<CodeExample>

​```kotlin
// Kotlin example here
​```


​```ts
// TypeScript example here
​```

// Flutter example is replaced with an auto-generated notice

</CodeExample>
````

For a regular code examples (non Wallet SDK) please use vanilla `CodeExample`
component.

#### LanguageSpecific

This component allows to render parts of documentation based on selected code.
To get started, crete 2 files in `component` directory:

```md
// ./component/kt/hello.mdx Hello, Kotlin!
```

```md
// ./component/ts/hello.mdx Hello, TypeScript!
```

Then, in the main document import both files and LanguageSpecific component:

```mdxjs
// main.mdx
import {LanguageSpecific} from "@site/src/components/LanguageSpecific";
import KtHello from "./component/kt/hello.mdx";
import TsHello from "./component/ts/hello.mdx";

<LanguageSpecific kt={<KtHello/>} ts={<TsHello/>} /
```

When user selects Kotlin, "Hello, Kotlin!" is going to be rendered, when
TypeScript is selected — "Hello, TypeScript!". Finally, for Flutter, nothing
would be rendered.
4 changes: 2 additions & 2 deletions docs/building-apps/wallet/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ sidebar_position: 20
import { LanguageSpecific } from "@site/src/components/LanguageSpecific";
import { WalletCodeExample as CodeExample } from "@site/src/components/WalletCodeExample";
import Header from "./component/header.mdx";
import KtInstall from "./component/kt_install.mdx";
import TsInstall from "./component/ts_install.mdx";
import KtInstall from "./component/kt/install.mdx";
import TsInstall from "./component/ts/install.mdx";

<Header WIPLangs={["ts", "dart"]} />

Expand Down