diff options
author | 2021-09-06 01:31:10 -0700 | |
---|---|---|
committer | 2021-09-06 01:31:10 -0700 | |
commit | 9f06fb014bd3acd729325e681573d04089346561 (patch) | |
tree | 64ced5fe8080ef584a5ea1edfca598b7ff67e42e /docs/src/components/Examples/CardLink.tsx | |
parent | b4d1c9bc64f14971339a691f5d860e5a952f6e8b (diff) | |
download | astro-9f06fb014bd3acd729325e681573d04089346561.tar.gz astro-9f06fb014bd3acd729325e681573d04089346561.tar.zst astro-9f06fb014bd3acd729325e681573d04089346561.zip |
cleanup docs changes
Diffstat (limited to 'docs/src/components/Examples/CardLink.tsx')
-rw-r--r-- | docs/src/components/Examples/CardLink.tsx | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/docs/src/components/Examples/CardLink.tsx b/docs/src/components/Examples/CardLink.tsx deleted file mode 100644 index 4c04be8a6..000000000 --- a/docs/src/components/Examples/CardLink.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { JSX } from '@babel/types'; -import type { Component } from 'preact'; -import { h, Fragment } from 'preact'; -import { useRef } from 'preact/hooks'; - -export type CardLinkProps = { - href: string; - name: string; - children: JSX | JSX[]; -}; - -const CardLink: Component<CardLinkProps> = ({ - href, - name, - children, -}: CardLinkProps): JSX.Element => { - const Card = useRef(null); - /** - * Set Title Attribute when Hovering over Card - * @param e - Mouse Enter Event - */ - function handleOnMouseEnter(e) { - const cardBody = Card.current.querySelector('.card-body'); - const cardThumb = Card.current.querySelector('.icon-image'); - const cardImg = Card.current.querySelector('.heroImg'); - - if ( - e.target === cardBody || - e.target === cardThumb || - e.target === cardImg - ) { - e.target.setAttribute( - 'title', - `Click to find out more about our ${name} template` - ); - } - } - /** - * Click Link Card to Page - * @param e - Click Event - * @returns new window location - */ - function handleOnClick(e) { - const card = e.target; - const mainLink = card.querySelector('.main-link'); - const clickableArea = ['.card-body', '.icon-image', '.heroImg']; - for (let area of clickableArea) { - if (e.currentTarget.classList.contains(area)) { - return mainLink.click(); - } - } - } - return ( - <div - ref={Card} - onClick={handleOnClick} - onMouseOver={handleOnMouseEnter} - aria-label={`Clickable Card taking you directly to the ${name} template`} - tabIndex="0" - > - {children} - </div> - ); -}; - -export default CardLink; |