PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Launch / components / Card.jsx

Card.jsx in Extendify 2.2.0, at src/Launch/components/Card.jsx

61 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classNames from 'classnames';
2 import { Checkmark } from '@launch/svg';
3
4 export const Card = ({
5 image,
6 heading,
7 name,
8 description,
9 selected,
10 onClick,
11 lock,
12 }) => {
13 return (
14 <div
15 role={lock ? undefined : 'button'}
16 tabIndex={lock ? undefined : 0}
17 aria-label={lock ? undefined : name}
18 className={classNames(
19 'overflow-hidden rounded-lg border border-gray-100 bg-transparent p-0 text-base',
20 {
21 'button-focus': !lock,
22 },
23 )}
24 onKeyDown={(e) => {
25 if (['Enter', 'Space', ' '].includes(e.key)) {
26 if (!lock) onClick();
27 }
28 }}
29 onClick={() => {
30 if (!lock) onClick();
31 }}>
32 <div className="flex min-w-sm justify-between border-b border-gray-100 p-2">
33 <div
34 className={classNames('flex items-center', {
35 'text-gray-700': !selected,
36 })}>
37 <span className="text-left">{name}</span>
38 {lock && (
39 <span className="dashicons dashicons-lock mr-6 h-4 w-4 pl-2 text-base leading-none"></span>
40 )}
41 </div>
42 {(lock || selected) && <Checkmark className="w-6 text-design-main" />}
43 </div>
44 <div className="flex flex-col">
45 {image ? (
46 <div
47 style={{ backgroundImage: `url(${image})` }}
48 className="h-32 bg-cover"
49 />
50 ) : (
51 <div className="h-32 bg-gray-100" />
52 )}
53 <div className="p-6">
54 <div className="mb-2 text-left text-base font-bold">{heading}</div>
55 <div className="text-left text-sm">{description}</div>
56 </div>
57 </div>
58 </div>
59 );
60 };
61