Skip to content

Commit a20fbdb

Browse files
shadowSize made configurable for icons on timeline, updated README
1 parent 36d2b2c commit a20fbdb

4 files changed

+19
-1
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ Icon of the element.
167167

168168
Add extra class name to the element's icon.
169169

170+
### `shadowSize={ String }`
171+
172+
Shadow size for icon (default: `'small'`). Available sizes are `'small'`, `'medium'` and `'large'`.
173+
170174
### `iconOnClick={ Function }`
171175

172176
onClick handler of the element's icon.

docs/vertical-load-more.js

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const VerticalLoadMore = () => {
7373
iconOnClick={loadMore}
7474
iconClassName="vertical-timeline-element-icon--button"
7575
icon={addButton()}
76+
shadowSize="small" // small, medium or large
7677
/>
7778
</VerticalTimeline>
7879
</div>

src/VerticalTimelineElement.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@
3535
width: 40px;
3636
height: 40px;
3737
border-radius: 50%;
38-
box-shadow: 0 0 0 4px white, inset 0 2px 0 rgba(0, 0, 0, 0.08), 0 3px 0 4px rgba(0, 0, 0, 0.05);
38+
}
39+
.vertical-timeline-element-icon.shadow-size-small {
40+
box-shadow: 0 0 0 2px white, inset 0 1px 0 rgba(0, 0, 0, 0.08), 0 2px 0 4px rgba(0, 0, 0, 0.05);
41+
}
42+
43+
.vertical-timeline-element-icon.shadow-size-medium {
44+
box-shadow: 0 0 0 3px white, inset 0 2px 0 rgba(0, 0, 0, 0.08), 0 3px 0 5px rgba(0, 0, 0, 0.05);
45+
}
46+
47+
.vertical-timeline-element-icon.shadow-size-large {
48+
box-shadow: 0 0 0 4px white, inset 0 2px 0 rgba(0, 0, 0, 0.08), 0 4px 0 6px rgba(0, 0, 0, 0.05);
3949
}
4050
.vertical-timeline--one-column-right .vertical-timeline-element-icon {
4151
right: 0;

src/VerticalTimelineElement.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const VerticalTimelineElement = ({
2424
triggerOnce: true,
2525
},
2626
visible = false,
27+
shadowSize = 'small', // small | medium | large
2728
}) => (
2829
<InView {...intersectionObserverProps}>
2930
{({ inView, ref }) => (
@@ -44,6 +45,7 @@ const VerticalTimelineElement = ({
4445
className={classNames(
4546
iconClassName,
4647
'vertical-timeline-element-icon',
48+
`shadow-size-${shadowSize}`, // for shadow size
4749
{
4850
'bounce-in': inView || visible,
4951
'is-hidden': !(inView || visible),
@@ -104,6 +106,7 @@ VerticalTimelineElement.propTypes = {
104106
style: PropTypes.shape({}),
105107
textClassName: PropTypes.string,
106108
visible: PropTypes.bool,
109+
shadowSize: PropTypes.string,
107110
intersectionObserverProps: PropTypes.shape({
108111
root: PropTypes.object,
109112
rootMargin: PropTypes.string,

0 commit comments

Comments
 (0)