-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: coyotte508 <[email protected]>
- Loading branch information
1 parent
1f4eb84
commit 04daec0
Showing
7 changed files
with
80 additions
and
4 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
Validating CODEOWNERS rules …
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
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,59 @@ | ||
# 🤗 Hugging Face Space Header | ||
|
||
A Typescript powered wrapper for the Space `mini_header` feature. | ||
|
||
## Install | ||
|
||
```console | ||
pnpm add @huggingface/space-header | ||
|
||
npm add @huggingface/space-header | ||
|
||
yarn add @huggingface/space-header | ||
``` | ||
|
||
### Deno | ||
|
||
```ts | ||
// esm.sh | ||
import { init } from "https://esm.sh/@huggingface/space-header" | ||
// or npm: | ||
import { init } from "npm:@huggingface/space-header" | ||
``` | ||
|
||
### Initialize | ||
```ts | ||
import { init } from "@huggingface/space-header"; | ||
|
||
// ... | ||
|
||
init(":user/:spaceId"); | ||
// init("enzostvs/lora-studio") for example | ||
``` | ||
❗Important note: The `init` method must be called on the client side. | ||
|
||
## Usage | ||
|
||
Uses the `target` option to inject the space-header into another DOM element | ||
|
||
```ts | ||
const app = document.getElementById("app"); | ||
|
||
// ... | ||
|
||
init(":user/:spaceId", { | ||
target: app | ||
}); | ||
``` | ||
|
||
If you already have the space data, you can also pass it as a parameter to avoid a fetch | ||
|
||
```ts | ||
init(space); | ||
|
||
// space = { | ||
// id: string; | ||
// likes: number; | ||
// author: string; | ||
// } | ||
``` |
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