-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
18 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
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,3 @@ | ||
module.exports = { | ||
sidebar: ["guides"], | ||
}; |
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,26 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import "./recipeBox.css" | ||
|
||
type size = "small" | "large" | ||
|
||
export default function Addons(props: { text: string, path: string, icon: string, img?: string }) { | ||
const [image, setImage] = useState({default: ""}); | ||
const [imageOnHover, setImageOnHover] = useState({default: ""}); | ||
const [hover, setHover] = useState(false); | ||
useEffect(() => { | ||
setImage(require(`../../../static/img/guides/${props.icon}.svg`)); | ||
setImageOnHover(require(`../../../static/img/guides/${props.icon}-orange.svg`)); | ||
},); | ||
|
||
const handleMouseOver = () => { | ||
setHover(true); | ||
} | ||
const handleMouseOut = () => { | ||
setHover(false); | ||
} | ||
|
||
return <a href={props.path} className={`recipe_box`} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut}> | ||
<div className="recipe_box__icon_wrapper" style={{ backgroundImage: `url(${ hover ? imageOnHover.default : image.default})` }}></div> | ||
<div className="recipe_box__text">{props.text}</div> | ||
</a> | ||
} |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,16 +1,53 @@ | ||
import * as React from "react"; | ||
import RecipeBox from "./recipeBox"; | ||
import "./recipeLayout.css" | ||
import AuthMode from "./authMode"; | ||
import Addons from "./add_ons"; | ||
import Refs from "./refs"; | ||
import "./recipeLayout.css"; | ||
import * as guides from "./guides.json"; | ||
|
||
type mode = "auth_modes" | "add_ons" | "ref"; | ||
|
||
type guide = { | ||
title: string, | ||
path: string, | ||
icon: string, | ||
img?: string, | ||
} | ||
title: string; | ||
path: string; | ||
icon: string; | ||
img?: string; | ||
}; | ||
|
||
export default function RecipeLayout(props: { guides: Array<guide>, cols: Number }) { | ||
return (<div className="recipe_wrapper" style={{ gridTemplateColumns: `repeat(${props.cols}, 1fr)` }}> | ||
{props.guides.map((ele, ind) => <RecipeBox key={ind} text={ele.title} size={props.cols == 3 ? "large" : "small"} path={ele.path} icon={ele.icon} img={ele.img} />)} | ||
</div>) | ||
} | ||
export default function RecipeLayout(props: { mode: mode }) { | ||
return ( | ||
<div | ||
className="recipe_wrapper" | ||
style={{ gridTemplateColumns: `repeat(${props.mode === "auth_modes" ? 3 : 2}, 1fr)` }} | ||
> | ||
{props.mode === "auth_modes" && guides[props.mode].map((ele: guide, ind: number) => ( | ||
<AuthMode | ||
key={ind} | ||
text={ele.title} | ||
size={"large"} | ||
path={ele.path} | ||
icon={ele.icon} | ||
img={ele.img} | ||
/> | ||
))} | ||
{props.mode === "add_ons" && guides[props.mode].map((ele: guide, ind: number) => ( | ||
<Addons | ||
key={ind} | ||
text={ele.title} | ||
path={ele.path} | ||
icon={ele.icon} | ||
img={ele.img} | ||
/> | ||
))} | ||
{props.mode === "ref" && guides[props.mode].map((ele: guide, ind: number) => ( | ||
<Refs | ||
key={ind} | ||
text={ele.title} | ||
path={ele.path} | ||
icon={ele.icon} | ||
img={ele.img} | ||
/> | ||
))} | ||
</div> | ||
); | ||
} |
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,26 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import "./recipeBox.css" | ||
|
||
type size = "small" | "large" | ||
|
||
export default function Refs(props: { text: string, path: string, icon: string, img?: string }) { | ||
const [image, setImage] = useState({default: ""}); | ||
const [imageOnHover, setImageOnHover] = useState({default: ""}); | ||
const [hover, setHover] = useState(false); | ||
useEffect(() => { | ||
setImage(require(`../../../static/img/guides/${props.icon}.svg`)); | ||
setImageOnHover(require(`../../../static/img/guides/${props.icon}-orange.svg`)); | ||
},); | ||
|
||
const handleMouseOver = () => { | ||
setHover(true); | ||
} | ||
const handleMouseOut = () => { | ||
setHover(false); | ||
} | ||
|
||
return <a href={props.path} className={`recipe_box`} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut}> | ||
<div className="recipe_box__icon_wrapper" style={{ backgroundImage: `url(${ hover ? imageOnHover.default : image.default})` }}></div> | ||
<div className="recipe_box__text">{props.text}</div> | ||
</a> | ||
} |
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