Skip to content

Commit 2eb4297

Browse files
committed
0.0.1
1 parent 729d2ec commit 2eb4297

2 files changed

Lines changed: 187 additions & 1 deletion

File tree

docs/README.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,93 @@
1+
[andculturecode-javascript-react-components](README.md)
12

23
# andculturecode-javascript-react-components
34

45
## Index
56

7+
### Interfaces
8+
9+
* [AnchorProps](interfaces/anchorprops.md)
10+
611
### Variables
712

13+
* [Anchor](README.md#const-anchor)
814
* [FactoryType](README.md#const-factorytype)
915

16+
### Functions
17+
18+
* [anchorDefault](README.md#const-anchordefault)
19+
1020
## Variables
1121

22+
### `Const` Anchor
23+
24+
**Anchor**: *RefForwardingComponent‹Link, [AnchorProps](interfaces/anchorprops.md)* = forwardRef(
25+
(props: AnchorProps, ref: React.Ref<HTMLAnchorElement>) => {
26+
let cssClassNames = [];
27+
28+
if (props.cssClassName) {
29+
cssClassNames.push(props.cssClassName);
30+
}
31+
32+
const onClickHandler = (e: React.MouseEvent<HTMLElement>) => {
33+
if (props.onClick != null) {
34+
props.onClick(e);
35+
}
36+
};
37+
38+
let relAttribute: string | undefined = undefined;
39+
if (props.target != null) {
40+
// Using target="_blank" without rel="noopener noreferrer" is a security risk: see
41+
// https://mathiasbynens.github.io/rel-noopener react/jsx-no-target-blank
42+
relAttribute = "noopener noreferrer";
43+
}
44+
45+
const commonProps = {
46+
"aria-label": props.ariaLabel,
47+
className: cssClassNames.join(" "),
48+
id: props.id,
49+
onClick: onClickHandler,
50+
ref: ref,
51+
target: props.target,
52+
rel: relAttribute,
53+
title: props.title,
54+
onKeyDown: props.onKeyDown,
55+
};
56+
57+
if (props.external === true) {
58+
return (
59+
<a href={props.to} {...commonProps}>
60+
{props.children}
61+
</a>
62+
);
63+
}
64+
65+
return (
66+
<Link to={props.to} {...commonProps}>
67+
{props.children}
68+
</Link>
69+
);
70+
}
71+
)
72+
73+
*Defined in [atoms/anchors/anchor.tsx:30](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L30)*
74+
75+
___
76+
1277
### `Const` FactoryType
1378

1479
**FactoryType**: *object*
1580

16-
*Defined in [tests/factories/factory-type.ts:1](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/de3ecc9/src/tests/factories/factory-type.ts#L1)*
81+
*Defined in [tests/factories/factory-type.ts:1](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/tests/factories/factory-type.ts#L1)*
1782

1883
#### Type declaration:
84+
85+
## Functions
86+
87+
### `Const` anchorDefault
88+
89+
**anchorDefault**(): *Element‹›*
90+
91+
*Defined in [atoms/anchors/anchor.stories.tsx:14](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.stories.tsx#L14)*
92+
93+
**Returns:** *Element‹›*

docs/interfaces/anchorprops.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
[andculturecode-javascript-react-components](../README.md)[AnchorProps](anchorprops.md)
2+
3+
# Interface: AnchorProps
4+
5+
## Hierarchy
6+
7+
* **AnchorProps**
8+
9+
## Index
10+
11+
### Properties
12+
13+
* [ariaLabel](anchorprops.md#optional-arialabel)
14+
* [children](anchorprops.md#optional-children)
15+
* [cssClassName](anchorprops.md#optional-cssclassname)
16+
* [external](anchorprops.md#optional-external)
17+
* [id](anchorprops.md#optional-id)
18+
* [onClick](anchorprops.md#optional-onclick)
19+
* [onKeyDown](anchorprops.md#optional-onkeydown)
20+
* [ref](anchorprops.md#optional-ref)
21+
* [target](anchorprops.md#optional-target)
22+
* [title](anchorprops.md#optional-title)
23+
* [to](anchorprops.md#to)
24+
25+
## Properties
26+
27+
### `Optional` ariaLabel
28+
29+
**ariaLabel**? : *undefined | string*
30+
31+
*Defined in [atoms/anchors/anchor.tsx:11](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L11)*
32+
33+
___
34+
35+
### `Optional` children
36+
37+
**children**? : *any*
38+
39+
*Defined in [atoms/anchors/anchor.tsx:12](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L12)*
40+
41+
___
42+
43+
### `Optional` cssClassName
44+
45+
**cssClassName**? : *undefined | string*
46+
47+
*Defined in [atoms/anchors/anchor.tsx:13](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L13)*
48+
49+
___
50+
51+
### `Optional` external
52+
53+
**external**? : *undefined | false | true*
54+
55+
*Defined in [atoms/anchors/anchor.tsx:14](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L14)*
56+
57+
___
58+
59+
### `Optional` id
60+
61+
**id**? : *undefined | string*
62+
63+
*Defined in [atoms/anchors/anchor.tsx:15](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L15)*
64+
65+
___
66+
67+
### `Optional` onClick
68+
69+
**onClick**? : *undefined | function*
70+
71+
*Defined in [atoms/anchors/anchor.tsx:16](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L16)*
72+
73+
___
74+
75+
### `Optional` onKeyDown
76+
77+
**onKeyDown**? : *undefined | function*
78+
79+
*Defined in [atoms/anchors/anchor.tsx:17](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L17)*
80+
81+
___
82+
83+
### `Optional` ref
84+
85+
**ref**? : *React.Ref‹HTMLAnchorElement›*
86+
87+
*Defined in [atoms/anchors/anchor.tsx:18](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L18)*
88+
89+
___
90+
91+
### `Optional` target
92+
93+
**target**? : *undefined | string*
94+
95+
*Defined in [atoms/anchors/anchor.tsx:19](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L19)*
96+
97+
___
98+
99+
### `Optional` title
100+
101+
**title**? : *undefined | string*
102+
103+
*Defined in [atoms/anchors/anchor.tsx:20](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L20)*
104+
105+
___
106+
107+
### to
108+
109+
**to**: *string*
110+
111+
*Defined in [atoms/anchors/anchor.tsx:21](https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/blob/729d2ec/src/atoms/anchors/anchor.tsx#L21)*

0 commit comments

Comments
 (0)