Skip to content

Commit

Permalink
Merge pull request #138 from jerboa88/136-add-aria-labels-to-buttons
Browse files Browse the repository at this point in the history
136 add aria labels to buttons
  • Loading branch information
jerboa88 authored Jun 19, 2024
2 parents c856e17 + 58f9d2f commit cc692d2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
3 changes: 1 addition & 2 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
} from './src/common/config-manager';
import { SOCIAL_IMAGES_DIR } from './src/common/constants';
import { getAbsoluteUrl } from './src/common/utilities';
// biome-ignore lint/style/noNamespaceImport: We need to import the entire Tailwind CSS configuration file
import * as tailwindConfig from './tailwind.config';
import tailwindConfig from './tailwind.config';

const SITE_METADATA = getSiteMetadata();
const DARK_THEME = getTheme('dark');
Expand Down
9 changes: 5 additions & 4 deletions src/components/input/base-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ export function BaseButton({
textClassName,
);

const computedButtonLabel = tooltipText ?? text;

const buttonElement = (
<motion.button
aria-label={computedButtonLabel}
{...{ type, disabled, layout, layoutRoot, ...buttonClassNameProps }}
>
<AnimatePresence mode="popLayout" initial={false}>
Expand All @@ -70,11 +73,9 @@ export function BaseButton({
</motion.button>
);

const computedTooltipText = tooltipText ?? text;

return computedTooltipText ? (
return !disabled && computedButtonLabel ? (
<Tooltip
text={computedTooltipText}
text={computedButtonLabel}
position={tooltipPosition}
className={tooltipClassName}
>
Expand Down
1 change: 1 addition & 0 deletions src/components/project-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function ProjectCard({ repo }: Props) {
<Pill text={repo.typeName} className={projectTypeColor} />
<GhostButton
icon={faGithub}
tooltipText={`View ${repo.name} on GitHub`}
{...ghostButtonClassNameProps}
disabled
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/seo/page-head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function PageHead({
<meta name="twitter:image" content={twitterImageUrl.toString()} />

<meta name="google" content="nositelinkssearchbox" />
<meta content={THEME.primary} name="theme-color" />
<meta name="theme-color" content={THEME.primary} />

<link rel="canonical" href={pageUrl.toString()} />

Expand Down
20 changes: 10 additions & 10 deletions src/config/color-mappings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import type { ColorMappingsConfig } from '../common/types';

export const colorMappingsConfig: ColorMappingsConfig = {
projectType: {
'android app': 'bg-lime-500',
extension: 'bg-amber-500',
'cli app': 'bg-red-500',
'js library': 'bg-green-500',
'node.js module': 'bg-green-500',
markdown: 'bg-purple-500',
website: 'bg-orange-500',
'web app': 'bg-orange-500',
other: 'bg-blue-500',
'gimp plugin': 'bg-blue-500',
'android app': 'bg-lime-600',
extension: 'bg-amber-600',
'cli app': 'bg-red-600',
'js library': 'bg-green-600',
'node.js module': 'bg-green-600',
markdown: 'bg-purple-600',
website: 'bg-orange-600',
'web app': 'bg-orange-600',
other: 'bg-blue-600',
'gimp plugin': 'bg-blue-600',
},
roleType: {
internship: 'bg-secondary',
Expand Down
7 changes: 4 additions & 3 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
-------------------------------
*/

import type { Config } from 'tailwindcss';
import plugin from 'tailwindcss/plugin';
import { getTheme } from './src/common/config-manager';

module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
export default {
content: ['src/**/*.{js,jsx,ts,tsx}'],
theme: {
fontFamily: {
sans: [
Expand Down Expand Up @@ -69,4 +70,4 @@ module.exports = {
themes: [{ dark: getTheme('dark') }, { light: getTheme('light') }],
darkTheme: 'dark',
},
};
} satisfies Config;

0 comments on commit cc692d2

Please sign in to comment.