MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / PaginationLink

Function PaginationLink

src/PaginationLink.js:25–91  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

23};
24
25function PaginationLink(props) {
26 let {
27 className,
28 cssModule,
29 next,
30 previous,
31 first,
32 last,
33 tag: Tag = 'a',
34 ...attributes
35 } = props;
36
37 const classes = mapToCssModules(
38 classNames(className, 'page-link'),
39 cssModule,
40 );
41
42 let defaultAriaLabel;
43 if (previous) {
44 defaultAriaLabel = 'Previous';
45 } else if (next) {
46 defaultAriaLabel = 'Next';
47 } else if (first) {
48 defaultAriaLabel = 'First';
49 } else if (last) {
50 defaultAriaLabel = 'Last';
51 }
52
53 const ariaLabel = props['aria-label'] || defaultAriaLabel;
54
55 let defaultCaret;
56 if (previous) {
57 defaultCaret = '\u2039';
58 } else if (next) {
59 defaultCaret = '\u203A';
60 } else if (first) {
61 defaultCaret = '\u00ab';
62 } else if (last) {
63 defaultCaret = '\u00bb';
64 }
65
66 let { children } = props;
67 if (children && Array.isArray(children) && children.length === 0) {
68 children = null;
69 }
70
71 if (!attributes.href && Tag === 'a') {
72 Tag = 'button';
73 }
74
75 if (previous || next || first || last) {
76 children = [
77 <span aria-hidden="true" key="caret">
78 {children || defaultCaret}
79 </span>,
80 <span className="visually-hidden" key="ariaLabel">
81 {ariaLabel}
82 </span>,

Callers

nothing calls this directly

Calls 1

mapToCssModulesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…