Skip to content

Commit

Permalink
fix: action items title to node
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jun 25, 2020
1 parent 8ef2224 commit 7047031
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ui/components/src/PanelContainer/PanelContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export const PanelContainer: FC<PanelContainerProps> = ({

const findPanel = useCallback(
(id: PanelContainerOwnProps['openTab']) => {
return panels.findIndex((p: ActionItem) => p.id === id || p.title === id);
return panels.findIndex((p: ActionItem) => p.id === id || p.node === id);
},
// do not update on each panel change
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(panels.map(p => p.id || p.title))],
[JSON.stringify(panels.map(p => p.id || p.node))],
);
React.useEffect(() => {
const index = findPanel(openTab);
Expand All @@ -77,7 +77,7 @@ export const PanelContainer: FC<PanelContainerProps> = ({
return panel.panel
? {
...panel,
title: `${tabsIndex === index ? 'close' : 'open'} ${panel.title}`,
node: `${tabsIndex === index ? 'close' : 'open'} ${panel.node}`,
onClick: (e: MouseEvent<HTMLButtonElement>) => {
if (index < 0) {
return undefined;
Expand Down Expand Up @@ -135,11 +135,11 @@ export const PanelContainer: FC<PanelContainerProps> = ({
}}
>
{panels.map((panel: ActionItem) => (
<Tab key={`playground_tab_${panel.title}`}>{panel.title}</Tab>
<Tab key={`playground_tab_${panel.node}`}>{panel.node}</Tab>
))}
</TabList>
{panels.map((panel: ActionItem) => (
<TabPanel key={`playground_panel_${panel.title}`}>
<TabPanel key={`playground_panel_${panel.node}`}>
{panel.panel}
</TabPanel>
))}
Expand Down
2 changes: 1 addition & 1 deletion ui/components/src/Source/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Source: FC<SourceProps> = ({

const actionsItems = [
{
title: copied ? 'copied' : 'copy',
node: copied ? 'copied' : 'copy',
onClick: onCopy,
id: 'copy',
'aria-label': 'copy the displayed source code',
Expand Down

0 comments on commit 7047031

Please sign in to comment.