Skip to content

Commit cd385f5

Browse files
authored
fix: Trade href="#" anchors for stylized buttons (#2074)
1 parent 42713df commit cd385f5

File tree

7 files changed

+66
-26
lines changed

7 files changed

+66
-26
lines changed

src/DateHeader.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ const DateHeader = ({ label, drilldownView, onDrillDown }) => {
77
}
88

99
return (
10-
<a href="#" onClick={onDrillDown} role="cell">
10+
<button
11+
type="button"
12+
className="rbc-button-link"
13+
onClick={onDrillDown}
14+
role="cell"
15+
>
1116
{label}
12-
</a>
17+
</button>
1318
)
1419
}
1520

src/EventEndingRow.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types'
22
import React from 'react'
3+
import clsx from 'clsx'
34
import EventRowMixin from './EventRowMixin'
45
import { eventLevels } from './utils/eventLevels'
56
import range from 'lodash/range'
@@ -78,14 +79,14 @@ class EventEndingRow extends React.Component {
7879
let count = eventsInSlot(segments, slot)
7980

8081
return count ? (
81-
<a
82+
<button
83+
type="button"
8284
key={'sm_' + slot}
83-
href="#"
84-
className={'rbc-show-more'}
85+
className={clsx('rbc-button-link', 'rbc-show-more')}
8586
onClick={e => this.showMore(slot, e)}
8687
>
8788
{localizer.messages.showMore(count)}
88-
</a>
89+
</button>
8990
) : (
9091
false
9192
)

src/TimeGridHeader.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ class TimeGridHeader extends React.Component {
4646
)}
4747
>
4848
{drilldownView ? (
49-
<a
50-
href="#"
49+
<button
50+
type="button"
51+
className="rbc-button-link"
5152
onClick={e => this.handleHeaderClick(date, drilldownView, e)}
5253
>
5354
{header}
54-
</a>
55+
</button>
5556
) : (
5657
<span>{header}</span>
5758
)}

src/less/month.less

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import './variables.less';
22

3-
43
.rbc-row {
54
display: flex;
65
flex-direction: row;
@@ -18,7 +17,6 @@
1817
background-color: @date-selection-bg-color;
1918
}
2019

21-
2220
.rbc-show-more {
2321
&:extend(.rbc-ellipsis);
2422
background-color: rgba(255, 255, 255, 0.3);
@@ -27,6 +25,11 @@
2725
font-size: 85%;
2826
height: auto;
2927
line-height: normal;
28+
color: @event-bg;
29+
&:hover,
30+
&:focus {
31+
color: darken(@event-bg, 10%);
32+
}
3033
}
3134

3235
.rbc-month-view {
@@ -73,7 +76,9 @@
7376
}
7477

7578
> a {
76-
&, &:active, &:visited {
79+
&,
80+
&:active,
81+
&:visited {
7782
color: inherit;
7883
text-decoration: none;
7984
}
@@ -106,7 +111,7 @@
106111
z-index: @event-zindex + 1;
107112
border: 1px solid #e5e5e5;
108113
background-color: #fff;
109-
box-shadow: 0 5px 15px rgba(0,0,0,.25);
114+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
110115
padding: 10px;
111116

112117
> * + * {
@@ -116,6 +121,6 @@
116121

117122
.rbc-overlay-header {
118123
border-bottom: 1px solid #e5e5e5;
119-
margin: -10px -10px 5px -10px ;
124+
margin: -10px -10px 5px -10px;
120125
padding: 2px 10px;
121126
}

src/less/styles.less

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import './variables.less';
22
@import './reset.less';
33

4-
54
.rbc-calendar {
65
box-sizing: border-box;
76
height: 100%;
@@ -67,13 +66,25 @@
6766
}
6867

6968
& > a {
70-
&, &:active, &:visited {
69+
&,
70+
&:active,
71+
&:visited {
7172
color: inherit;
7273
text-decoration: none;
7374
}
7475
}
7576
}
7677

78+
.rbc-button-link {
79+
color: inherit;
80+
background: none;
81+
margin: 0;
82+
padding: 0;
83+
border: none;
84+
cursor: pointer;
85+
user-select: text;
86+
}
87+
7788
.rbc-row-content {
7889
position: relative;
7990
user-select: none;
@@ -95,16 +106,15 @@
95106
display: none;
96107
}
97108

98-
-ms-overflow-style: none; /* IE and Edge */
99-
scrollbar-width: none; /* Firefox */
109+
-ms-overflow-style: none; /* IE and Edge */
110+
scrollbar-width: none; /* Firefox */
100111
}
101112
}
102113

103114
.rbc-today {
104115
background-color: @today-highlight-bg;
105116
}
106117

107-
108118
@import './toolbar.less';
109119
@import './event.less';
110120
@import './month.less';

src/sass/month.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
background-color: $date-selection-bg-color;
1818
}
1919

20-
2120
.rbc-show-more {
2221
@extend .rbc-ellipsis;
2322
background-color: rgba(255, 255, 255, 0.3);
@@ -26,6 +25,11 @@
2625
font-size: 85%;
2726
height: auto;
2827
line-height: normal;
28+
color: $event-bg;
29+
&:hover,
30+
&:focus {
31+
color: darken($event-bg, 10%);
32+
}
2933
}
3034

3135
.rbc-month-view {
@@ -72,7 +76,9 @@
7276
}
7377

7478
> a {
75-
&, &:active, &:visited {
79+
&,
80+
&:active,
81+
&:visited {
7682
color: inherit;
7783
text-decoration: none;
7884
}
@@ -105,7 +111,7 @@
105111
z-index: $event-zindex + 1;
106112
border: 1px solid #e5e5e5;
107113
background-color: #fff;
108-
box-shadow: 0 5px 15px rgba(0,0,0,.25);
114+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
109115
padding: 10px;
110116

111117
> * + * {
@@ -115,6 +121,6 @@
115121

116122
.rbc-overlay-header {
117123
border-bottom: 1px solid #e5e5e5;
118-
margin: -10px -10px 5px -10px ;
124+
margin: -10px -10px 5px -10px;
119125
padding: 2px 10px;
120126
}

src/sass/styles.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,25 @@
6666
}
6767

6868
& > a {
69-
&, &:active, &:visited {
69+
&,
70+
&:active,
71+
&:visited {
7072
color: inherit;
7173
text-decoration: none;
7274
}
7375
}
7476
}
7577

78+
.rbc-button-link {
79+
color: inherit;
80+
background: none;
81+
margin: 0;
82+
padding: 0;
83+
border: none;
84+
cursor: pointer;
85+
user-select: text;
86+
}
87+
7688
.rbc-row-content {
7789
position: relative;
7890
user-select: none;
@@ -94,8 +106,8 @@
94106
display: none;
95107
}
96108

97-
-ms-overflow-style: none; /* IE and Edge */
98-
scrollbar-width: none; /* Firefox */
109+
-ms-overflow-style: none; /* IE and Edge */
110+
scrollbar-width: none; /* Firefox */
99111
}
100112
}
101113

0 commit comments

Comments
 (0)