Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2022 GitHub and contributors
Copyright 2022 Alexis Rico

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
44 changes: 1 addition & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
# GitHub Blocks Template

Use this repository as a starter template for building your own Blocks.
## Quickstart

> 🛑 Currently, you must be flagged into the [GitHub Blocks Technical Preview](https://blocks.githubnext.com) in order to develop blocks. There is no "offline" development mode at this time.

Fork this repo using the `Use this template` button above:

!["Use this template" button](https://user-images.githubusercontent.com/8978670/144893319-5d45ab5c-12c0-42b4-99f8-97f658deb03b.png)

Then, clone _your_ repo (not [this one!](https://github.com/githubnext/blocks-template)) and get ready for action:

```bash
yarn # install dependencies
yarn start # start the dev server
# Or use npm, pnpm, you know the drill
```

When you visit [localhost:4000](https://localhost:4000) in your browser, you'll be
redirected to the Blocks app, but your locally-developed blocks will appear in the block picker:

<img alt="Block picker" src="https://user-images.githubusercontent.com/56439/181648955-101b6567-3f9b-44b3-af99-7ef3ca6161b9.png" width="418" />

This template includes one example File Block and one Folder Block. The dev server supports hot reloading, so make some changes, and see what they do!

## Under the hood

Currently, Blocks are [React](https://reactjs.org/) components. They have a well-defined contract with their surroundings, and receive a [fixed set of props](TODO) when they are instantiated. They are developed in [TypeScript](https://www.typescriptlang.org/), and bundled with [Vite](https://vitejs.dev/).

## More Info

Visit [githubnext/blocks](https://blocks.githubnext.com/githubnext/blocks) for a full tutorial, documentation, and examples.

You should also join us in our discord! There's a [#blocks channel](https://discord.com/channels/735557230698692749/1039950186136469535) where you can connect with us and other folks who are building Blocks:

> 👋 https://discord.gg/githubnext
## License

MIT

✌️ ❤️
_GitHub Next_
# SferaDev's GitHub Blocks
16 changes: 16 additions & 0 deletions blocks.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,21 @@
"description": "A diff block",
"entry": "blocks/diff-block/index.tsx",
"matches": ["*"]
},
{
"type": "file",
"id": "test-block",
"title": "Test Block",
"description": "A test block",
"entry": "blocks/test-block/index.tsx",
"matches": ["*"]
},
{
"type": "file",
"id": "ide-block",
"title": "IDE Block",
"description": "A IDE block",
"entry": "blocks/ide-block/index.tsx",
"matches": ["*"]
}
]
8 changes: 4 additions & 4 deletions blocks/diff-block/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { ActionList, ActionMenu, Box, ButtonGroup, Text } from '@primer/react';
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer';
import styled from 'styled-components';
import './Block.css';
import { Button } from './components/Button';
import { decode } from './utils/base64';
import { useGitHubData } from './utils/useGitHubData';
import { useLocalStorageState } from './utils/useLocalStorageState';
import { Button } from '../../components/Button';
import { decode } from '../../utils/base64';
import { useGitHubData } from '../../hooks/useGitHubData';
import { useLocalStorageState } from '../../hooks/useLocalStorageState';

export function DiffBlock(props: FileBlockProps) {
const { context, originalContent } = props;
Expand Down
3 changes: 3 additions & 0 deletions blocks/ide-block/Block.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pre {
background: papayawhip;
}
Loading