Skip to content

Commit

Permalink
Some changes to the side tray to help make writing an issue for #540
Browse files Browse the repository at this point in the history
  • Loading branch information
Irev-Dev committed Oct 10, 2021
1 parent 9f769d6 commit 9337232
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions app/web/src/components/IdeSideBar/sidebarConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ const DiscordLink = () => (
</a>
)

const settingsConfig = [
interface settingsConfig {
title: string
name: string
Content: React.FC
}

const settingsConfig: settingsConfig[] = [
{
title: 'Editor',
name: 'editor',
open: false,
content: (
Content: () => (
<div className="p-2">
<p>
<em>Coming Soon</em>
Expand All @@ -84,8 +89,7 @@ const settingsConfig = [
{
title: 'Viewer',
name: 'viewer',
open: false,
content: (
Content: () => (
<div className="p-2">
<p>
<em>Coming Soon</em>
Expand All @@ -101,8 +105,7 @@ const settingsConfig = [
{
title: 'Console',
name: 'console',
open: false,
content: (
Content: () => (
<div className="p-2">
<p>
<em>Coming Soon</em>
Expand Down Expand Up @@ -135,24 +138,26 @@ function SettingsMenu({ parentName }: { parentName: string }) {
const { state, thunkDispatch } = useIdeContext()
return (
<article className="">
{settingsConfig.map((item) => (
{settingsConfig.map(({ name, title, Content }) => (
<details
key={'settings-tray-' + item.name}
open={state.sideTray.slice(-1)[0] === item.name}
onClick={(e) => {
e.preventDefault()
thunkDispatch((dispatch) =>
dispatch({
type: 'settingsButtonClicked',
payload: [parentName, item.name],
})
)
}}
key={'settings-tray-' + name}
open={state.sideTray.slice(-1)[0] === name}
>
<summary className="px-2 py-2 bg-ch-pink-800 bg-opacity-10 my-px cursor-pointer">
{item.title}
<summary
className="px-2 py-2 bg-ch-pink-800 bg-opacity-10 my-px cursor-pointer"
onClick={(e) => {
e.preventDefault()
thunkDispatch((dispatch) =>
dispatch({
type: 'settingsButtonClicked',
payload: [parentName, name],
})
)
}}
>
{title}
</summary>
{item.content}
<Content />
</details>
))}
</article>
Expand Down

0 comments on commit 9337232

Please sign in to comment.