Skip to content

Commit

Permalink
Merge pull request #24 from scroll-tech/develop
Browse files Browse the repository at this point in the history
Update from develop
  • Loading branch information
Turupawn authored Aug 8, 2023
2 parents 4ed3b82 + 2831036 commit 72721a9
Show file tree
Hide file tree
Showing 39 changed files with 613 additions and 196 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/update-algolia-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,28 @@ on: [push]
jobs:
update-prod-index:
if: ${{ github.ref == 'refs/heads/main' }}
name: Update algolia index
name: Update algolia index -- Prod
runs-on: ubuntu-latest
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
ALGOLIA_INDEX_NAME: prod_scroll-docs
defaults:
run:
working-directory: ./
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install Dependencies
run: npm i
- name: Build
run: npm run build
- name: Update index
run: npm run update-algolia-index

update-dev-index:
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/sepolia-content-population' }}
name: Update algolia index -- Dev
runs-on: ubuntu-latest
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
Expand Down
29 changes: 28 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"tailwindcss": "^3.2.4",
"to-querystring": "^1.1.1"
"to-querystring": "^1.1.1",
"turndown": "^7.1.2"
},
"devDependencies": {
"@astrojs/mdx": "^0.11.6",
Expand Down
Binary file added public/fonts/FTPolarMono-Medium.woff2
Binary file not shown.
Binary file added public/fonts/FTPolarMono-Regular.woff2
Binary file not shown.
Binary file added public/fonts/TransSansPremium-Bold.woff2
Binary file not shown.
66 changes: 66 additions & 0 deletions public/scroll-docs-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 1 addition & 9 deletions public/scroll-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Aside.astro
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const icons = {
background-color: var(--aside-bg);

/* display: flex; */
@apply p-[30px] gap-4 rounded-[27px] text-info;
@apply p-[30px] gap-4 rounded-[27px] text-info mb-[1rem];
}

aside p.title {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer/PureFooter/PureFooter.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.footerLayout {
grid-template-areas: "logo about resource follow version";
@apply grid w-full pb-[80px] pt-[60px] px-[20px] grid-cols-2 gap-[1em] bg-[var(--black-100)] md:grid-cols-[2fr_2fr_2fr_2fr_4fr] md:pb-[100px];
@apply grid w-full pb-[80px] pt-[60px] px-[20px] grid-cols-2 gap-[1em] bg-[var(--black-100)] lg:grid-cols-[2fr_2fr_2fr_2fr_4fr] lg:pb-[100px];
}

@media screen and (max-width: 768px) {
@media screen and (max-width: 50em) {
.footerLayout {
grid-template-areas:
"logo follow"
Expand Down
1 change: 1 addition & 0 deletions src/components/Footer/Subscribe/EmailInput.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
.inputBase::placeholder {
color: #dcdcdc;
}

@media (min-width: 50em) {
.container {
height: 54px;
Expand Down
7 changes: 4 additions & 3 deletions src/components/Footer/Subscribe/Subscribe.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.container {
@apply py-[60px] px-[20px] bg-[#EAF5FD] md:py-[32px];
@apply py-[60px] px-[20px] bg-[#EAF5FD] lg:py-[32px];
}

.subscribeBox {
@apply flex flex-col gap-[18px] items-start md:gap-[22px] md:items-center md:flex-row md:justify-between;
@apply flex flex-col gap-[18px] items-start lg:gap-[22px] lg:items-center lg:flex-row lg:justify-between;
}

.subscribeIcon {
Expand Down Expand Up @@ -33,7 +33,7 @@
/* margin-top: 32px; */
flex: 1;
width: auto;
text-align: right;
text-align: left;
width: 100%;
}

Expand Down Expand Up @@ -69,6 +69,7 @@
}

.emailBox {
text-align: right;
}

.errorMessage {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const section = frontmatter?.section ?? ""
<nav class="nav-wrapper" title="Top Navigation">
<div class="logo flex items-center">
<a href={localizePath("/")}>
<img src={dark ? "/scroll-white.svg" : "/scroll.svg"} alt={CONFIG.SITE.title ?? "Documentation"} />
<img src={dark ? "/scroll-docs-white.svg" : "/scroll.svg"} alt={CONFIG.SITE.title ?? "Documentation"} />
</a>
</div>
<div class="right-box">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Search/Search.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
}
}

@media (max-width: 1200px) and (min-width: 50em) {
@media (max-width: 72em) and (min-width: 50em) {
:global(.right-box .tools) {
display: none;
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/Header/Search/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ const searchClient = algoliasearch(CONFIG.ALGOLIA.appId, CONFIG.ALGOLIA.publicAp

const recommendedArticles = [
{
title: "Suggested Article A",
url: "/",
title: "User Guide",
url: "/en/user-guide",
},
{
title: "Suggested Article B",
url: "/",
title: "Developer Quickstart",
url: "/en/developers/developer-quickstart",
},
{
title: "Suggested Article C",
url: "/",
title: "Sepolia Testnet Contracts",
url: "/en/developers/alpha-testnet-contracts",
},
{
title: "Suggested Article D",
url: "/",
title: "Architecture Overview",
url: "/en/technology/architecture/scroll-architecture",
},
]

Expand Down Expand Up @@ -141,7 +141,7 @@ export function SearchModal({ size = "mini", isOpen, onClose }: { size: Size; is
const getIndexName = () => {
if (typeof window === "undefined") return
const host = window.location.hostname
if (host === "docs.scroll.io") return CONFIG.ALGOLIA.productionIndexName
if (host === "docs.scroll.io" || host === "docs.scroll.xyz") return CONFIG.ALGOLIA.productionIndexName
return CONFIG.ALGOLIA.testIndexName
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/HomeSearch/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
width: 22px;
}

@media screen and (max-width: 600px) {
@media screen and (max-width: 50em) {
.container {
width: 100%;
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/MarkmapView/MarkmapaView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React, { useState, useRef, useEffect } from 'react';
import { Transformer } from 'markmap-lib';
import { Markmap } from 'markmap-view';
import TurndownService from 'turndown';

const transformer = new Transformer();

export default function MarkmapHooks({value}) {

export default function MarkmapHooks({value, children}) {
const turndownService = new TurndownService()
const transformer = new Transformer();

// Ref for SVG element
const refSvg = useRef<SVGSVGElement>();
// Ref for markmap object
Expand All @@ -21,7 +25,8 @@ export default function MarkmapHooks({value}) {
// Update data for markmap once value is changed
const mm = refMm.current;
if (!mm) return;
const { root } = transformer.transform(value);
const markdown = turndownService.turndown(children?.props?.value) || value
const { root } = transformer.transform(markdown);
mm.setData(root);
mm.fit();
}, [refMm.current, value]);
Expand Down
22 changes: 16 additions & 6 deletions src/components/MarkmapView/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ import path from "node:path"
import MarkmapaView from "./MarkmapaView.tsx"
export type Props = {
src: string
src?: string
content?: string
}
const { src } = Astro.props as Props
const { src, content } = Astro.props as Props
// remove leading slashes
const cleanSrc = src ? src.replace(/^\/+/, "") : ""
const data = (await fs.readFile(path.join(process.cwd(), "public", src), "utf-8")).toString()
let data: string = ""
// remove leading slashes
const cleanSrc = src.replace(/^\/+/, "")
async function readFromFile(src: string) {
return (await fs.readFile(path.join(process.cwd(), "public", src), "utf-8")).toString()
}
if (src) {
data = await readFromFile(src)
}
---

<MarkmapaView client:idle value={data} />
<MarkmapaView client:idle value={data}>
<slot />
</MarkmapaView>
Loading

0 comments on commit 72721a9

Please sign in to comment.