Skip to content

Commit

Permalink
Merge pull request #46 from NASA-IMPACT/card-hover
Browse files Browse the repository at this point in the history
Change hover,focus style for theme card, add screen reader only heading
  • Loading branch information
hanbyul-here authored Nov 23, 2023
2 parents a984df5 + 41575a7 commit 368b51f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions overrides/common/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export const hoverStyle = css`
`;

export const focusStyle = css`
// Very subtle outline for mouse
// Very subtle outline for mouse focus
&:focus:not(:focus-visible) {
outline: none
box-shadow: ${themeVal("boxShadow.elevationA")}
}
// Enable outline for keyboard
// More visible outline for keyboard focus
&:focus,
&:focus-visible {
outline: 5px auto ${themeVal("color.base-300")};
outline: 5px auto ${themeVal("color.primary")};
}
`;

Expand Down
7 changes: 6 additions & 1 deletion overrides/components/theme-cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ const ThemeCard = styled.article`
display: flex;
flex-flow: column nowrap;
border-top: 1px solid ${themeVal("color.base-200a")};
${hoverStyle}
&:hover {
h3 {
text-decoration: underline;
}
}
`;
const ThemeCardImageWrapper = styled.figure`
height: 240px;
Expand Down
15 changes: 13 additions & 2 deletions overrides/theme/content/component.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import React from "$veda-ui/react";
import { stories} from "veda";
import ThemeCards from '../../components/theme-cards';
import styled from "$veda-ui/styled-components";
import { stories } from "veda";
import ThemeCards from "../../components/theme-cards";
import { Fold } from "$veda-ui-scripts/components/common/fold";
import { themeLandingPageIds } from "../../common/story-data";

/* Screen reader only h2 for heading hierarchy */
const SrOnlyH2 = styled.h2`
width: 1px;
height: 1px;
left: -10000px;
overflow: hidden;
position: absolute;
top: auto;
`;

const themeData = Object.keys(stories)
.map((key) => stories[key].data)
Expand All @@ -12,6 +22,7 @@ const themeData = Object.keys(stories)
export default function ThemeLandingPage() {
return (
<Fold>
<SrOnlyH2> Nine themes</SrOnlyH2>
<ThemeCards storyIds={themeLandingPageIds} />
</Fold>
);
Expand Down

0 comments on commit 368b51f

Please sign in to comment.