question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing `rbc-now` class

See original GitHub issue

I want to style only the date number of the current date, but the rbc-now class is missing from the rbc-current element. If I style by rbc-current, then all the dates in every month are styled, for example: 9th August, 9th September, 9th Ocotber etc.

The demo works correctly.

I’m using the latest stable version of the component.

Can you please give me an advice? 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
jquensecommented, Aug 17, 2017

we should also fix the missing class.

2reactions
owzzzcommented, Aug 31, 2017

I’ve created a solution, code below:

I created a custom dateHeader Component for the month view. The documentation was not very clear but I figured out that the dateHeader component is the element that is responsible for outputting the date label in a cell.

const components = { month: { dateHeader: CellLabel } };

I then created the CellLabel component, notice I’m using styled-components to style but you could use the className attribute to toggle a class. rbc-now;

import React, { Component } from 'react';
import styled from 'styled-components';
import moment from 'moment';


const CellElem = styled.div'
	position: relative;

	a {
		background:	${(props) => props.isToday ? 'black' : 'none'};
		color: ${(props) => props.isToday ? 'white' : 'black'};

    	        position: absolute;
    	        top: ${(props) => props.isToday ? '-28px' : '-32px'};
    	        right: ${(props) => props.isToday ? '8px' : '5px'};
    	       display: flex;
    	       align-items: center;
    	       justify-content: center;
    	       width: 30px;
    	       height: 30px;
    	       border-radius: 15px;
    	       text-decoration: none;
	}
';


class CellLabel extends Component {
  render() {
    return (
      <CellElem {...this.props} isToday={moment(this.props.date).isSame(new Date(), "day")}>
      	<a href="#">{this.props.label}</a>
      </CellElem>
    );
  }
}

Fix for rbc-now class still needs to be added, but this worked as an interim solution.

If I get time over the weekend I’ll open a pull request with a proper fix for the ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing `rbc-now` class - reactjs - Stack Overflow
I want to style only the date number of the current date, but the rbc-now class is missing from the rbc-current element.
Read more >
Reformation Bible College: Study Theology at RBC
Prepare to reach the lost through missions and build up the broken through counseling, diving deep into the rich resources of biblical truth...
Read more >
Red Bank Catholic Class of 1980 | Facebook
Hey all.....I saw David Crowton in Foodtown today. Just wanted to let you know that he lost his Mom on. February 14. She...
Read more >
RAD | Ridgecrest Baptist Church
CLICK THE LINK BELOW TO REGISTER FOR YOUR COURSE! ... Studies show us that the #1 item in the lost and found department...
Read more >
What to do if you lose your wallet - MoneySense
... that your bank cards, credit cards and ID are missing. ... RBC now has a feature that will allow you to lock...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found