Skip to content

Commit

Permalink
Merge pull request #22 from bedrock-apis/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
conmaster2112 authored Feb 12, 2024
2 parents 9ab04d5 + 18a5212 commit 8e9f4a9
Show file tree
Hide file tree
Showing 7 changed files with 983 additions and 23 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/push_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pull Request Check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
cache-dependency-path: package-lock.json

- name: Install Project 🔧
run: npm run init

- name: Check Linting 🔎
run: npm run lint

- name: Check Build 🔧
run: npm run build
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 47 additions & 21 deletions src/mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MDXComponents } from "mdx/types";
import Link from "next/link";

export function useMDXComponents(components: MDXComponents): MDXComponents {
const p = {
h1: Headers(50,true),
h1: Headers(50, true),
h2: Headers(34),
h3: Headers(28),
h4: Headers(24),
Expand All @@ -21,53 +21,79 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
return p;
}
let i = 0;
function Headers(fontSize: number, underLine: boolean = false){
return ({children}:{children?: any})=><div>
<h1 style={{fontSize}}>{children}</h1>
{underLine?<div className="bg-text-primary h-1 opacity-50 mb-5"/>:undefined}
function Headers(fontSize: number, underLine: boolean = false) {
return ({ children }: { children?: any }) => <div>
<h1 style={{ fontSize }}>{children}</h1>
{underLine ? <div className="bg-sub -mt-1 h-[2px] mx-1 mb-2"/> : undefined}
</div>
}
function Paragraph({children}:{children?: any}){
function Paragraph({ children }: { children?: any }) {
return <p>
{children}
</p>
}
function A({children,href }:{children?: any, href?: string}){
return <Link className="text-cyan-500 hover:underline" href={href??"/"}>
function A({ children, href }: { children?: any, href?: string }) {
return <Link className="text-cyan-500 hover:underline" href={href ?? "/"}>
{children}
</Link>
}
function Li({children, kind}:{children?: any, kind?: string}){ //•▪●○►○●□■
function Li({ children, kind }: { children?: any, kind?: string }) { //•▪●○►○●□■
return <li key={"____" + i++} className="ml-5 pb-1.5">
{children}
</li>
}
function Ul(params: any){
function Ul(params: any) {
//console.log(params);
return <ul className="px-4">
{params.children.map((e: any)=>typeof e.type === "function"?(e.type({children: e.props.children, kind:"-"})):e)}
{params.children.map((e: any) => typeof e.type === "function" ? (e.type({ children: e.props.children, kind: "-" })) : e)}
</ul>
}
export function Summary({children, color}:{children?: any, color?: string}){
export function Summary({ children, color }: { children?: any, color?: string }) {
return <div className="border bg-black bg-opacity-20 rounded-sm px-2 py-1">
{children}
</div>
}
export function Code(params: any){
export function Code(params: any) {
return <code className="bg-opacity-0">
{params.children}
</code>
}
export function PreCode(params: any){
return <pre className="border m-1 bg-black bg-opacity-20 border-text-primary rounded-[0.3rem] px-2 py-1" style={{border:"1px solid rgba(150, 160, 170, 0.2)"}}>
{params.children}
</pre>
export function PreCode(params: any) {
return (
<pre className="border m-1 bg-black bg-opacity-20 border-text-primary rounded-[0.3rem] px-2 py-1" style={{ border: "1px solid rgba(150, 160, 170, 0.2)" }}>
{
params.className in languageToTextMap?
<>
<p className="text-xl m-1">{languageToTextMap[params.className]}</p>
<div className="bg-sub h-[1px] mx-1 mb-2 rounded-sm" />
</>
:(params.className?console.warn("Unknown code block: " + params.className) as undefined:undefined)
}
<div className="px-1">
{params.children}
</div>
</pre>
)
}
export function Image(params: any){
export function Image(params: any) {
return <img className="m-3 rounded-sm max-h-[25rem] max-w-full" src={"resources/" + params.src} alt="logo" />
}
export function Table(params: any){
export function Table(params: any) {
return <table className="m-1 bg-black bg-opacity-5 rounded-[0.3rem]">
{params.children}
</table>
}
}

const languageToTextMap = {
"language-js": "JavaScript",
"language-javascript": "JavaScript",
"language-ts": "TypeScript",
"language-typescript": "TypeScript",
"language-json": "JSON",
"language-md": "Markdown",
"language-markdown": "Markdown",
"language-cpp": "C++",
"language-c": "C",
"language-h": "C",
"language-hpp": "C",
} as { [key: string]: any }
2 changes: 2 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
--accent: #987420;
--accent-highlight: #f4805d;
--text-primary: #d7dbde;

--sub: #86888a;
}

* {
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const config: Config = {
"highlight": "var(--highlight)",
"accent": "var(--accent)",
"accent-highlight": "var(--accent-highlight)",
"text-primary": "var(--text-primary)"
"text-primary": "var(--text-primary)",
"sub": "var(--sub)"
}
},
},
Expand Down
11 changes: 10 additions & 1 deletion wiki/NewDownmark.mdx → wiki/NewDownmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ Paragraph **Bolt** *italic* [Link](/markdown)?
- sList2

Text
```js
```javascript
import * as mc from "@minecraft/server";

console.log("test");
// The Comment
```

```md
## Header
Text
- More
```
The test
```cpp
- More
```
> Lmaoe?
![[]](sidebar.png)
Expand Down
Loading

0 comments on commit 8e9f4a9

Please sign in to comment.