Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ['master']
branches: ['master', 'main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelpTextBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HelpTextBlock = () => {
return (
<div className="block-bg-gradient secondary-block help-text-block">
<BlockTitle title="Help" />
<p className="help-text">{focusedMenuItem ? focusedMenuItem?.description : "Hover over or focus on a link to see more information here."}
<p className="help-text">{focusedMenuItem?.description ?? "Hover over or focus on a link to see more information here."}
</p>
</div>
);
Expand Down
8 changes: 2 additions & 6 deletions src/components/PortfolioNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ const PortfolioNavigation = () => {
target="_blank"
rel="noopener noreferrer"
onFocus={() => {
if (setFocusedMenuItem) {
setFocusedMenuItem(link);
}
setFocusedMenuItem?.({ id: link.name, label: link.name, description: link.description });
}}
onMouseOver={() => {
if (setFocusedMenuItem) {
setFocusedMenuItem(link);
}
setFocusedMenuItem?.({ id: link.name, label: link.name, description: link.description });
}}
>
<div className="selection-cursor"></div>
Expand Down
20 changes: 14 additions & 6 deletions src/context/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ export type Theme = 'ff7-theme' | 'ff8-theme' | 'default-theme';

export type Layout = 'wide' | 'boxed';

export type MenuItem = {
id?: string;
label?: string;
description?: string;
// allow extra metadata when needed
[key: string]: unknown;
};

export type AppContextType = {
theme: Theme;
toggleTheme: () => void;
Expand All @@ -13,10 +21,10 @@ export type AppContextType = {
layout: Layout;
setLayout: (l: Layout) => void;
siteName: string;
profileLinks: { name: string; url: string }[];
portfolioLinks: { name: string; url: string }[];
setFocusedMenuItem: (item: object | undefined) => void;
focusedMenuItem: object | undefined;
profileLinks: { name: string; url: string, description: string }[];
portfolioLinks: { name: string; url: string, description: string }[];
setFocusedMenuItem: (item: MenuItem | undefined) => void;
focusedMenuItem: MenuItem | undefined;
};

const AppContext = createContext<AppContextType | undefined>(undefined);
Expand Down Expand Up @@ -63,9 +71,9 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
else body.classList.remove('ff8-theme');
}, [theme]);

const [focusedMenuItem, setFocusedMenuItemState] = useState<object | undefined>(undefined);
const [focusedMenuItem, setFocusedMenuItemState] = useState<MenuItem | undefined>(undefined);

const setFocusedMenuItem = useCallback((item: object | undefined) => {
const setFocusedMenuItem = useCallback((item: MenuItem | undefined) => {
// store the focused menu item in state so consumers can read it
setFocusedMenuItemState(item);
}, []);
Expand Down
Loading