generated from networkservicemesh/cmd-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement reusable 'Display' top panel with a variable set of options.
Signed-off-by: Vitaliy Guschin <[email protected]>
- Loading branch information
Vitaliy Guschin
committed
Apr 17, 2024
1 parent
dba78d7
commit d3bb769
Showing
8 changed files
with
209 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { DisplayPanelOptionEnv } from "../model"; | ||
|
||
interface TopDisplayOptionsPanelProps { | ||
options: DisplayPanelOptionEnv[]; | ||
setShowOptionsPanel: (v: boolean) => void; | ||
} | ||
|
||
export default function TopDisplayOptionsPanel({ options, setShowOptionsPanel }: TopDisplayOptionsPanelProps) { | ||
return ( | ||
<div className="top-display-options-panel" onMouseLeave={() => setShowOptionsPanel(false)}> | ||
{options.map((opt, index) => ( | ||
<div key={index} className="top-display-options-panel-item" onClick={() => opt.onClick()}> | ||
<input | ||
type="checkbox" | ||
checked={opt.checked} | ||
onChange={() => {}} | ||
className="top-display-options-panel-item" | ||
/> | ||
{opt.label} | ||
</div> | ||
))} | ||
</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,23 @@ | ||
import { useState } from 'react'; | ||
import TopDisplayOptionsPanel from "./TopDisplayOptionsPanel"; | ||
import { DisplayPanelOptionEnv } from "../model"; | ||
|
||
interface TopDisplayPanelProps { | ||
options: DisplayPanelOptionEnv[]; | ||
} | ||
|
||
export default function TopDisplayPanel({ options }: TopDisplayPanelProps) { | ||
const [showOptionsPanel, setShowOptionsPanel] = useState(false); | ||
|
||
return ( | ||
<> | ||
<div | ||
className="top-display-panel" | ||
onClick={() => setShowOptionsPanel(!showOptionsPanel)} | ||
> | ||
<div>Display</div> | ||
</div> | ||
{showOptionsPanel && <TopDisplayOptionsPanel options={options} setShowOptionsPanel={setShowOptionsPanel}/>} | ||
</> | ||
); | ||
} |
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
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
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,3 +1,4 @@ | ||
export const SET_NODES = 'SET_NODES'; | ||
export const SET_EDGES = 'SET_EDGES'; | ||
export const SET_SELECTED_MENU_ITEM ='SET_SELECTED_MENU_ITEM'; | ||
export const SWITCH_DISPLAY_PANEL_OPTION ='SWITCH_DISPLAY_PANEL_OPTION'; |
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