Issue with styling React component inline based on props value and condition not functioning properly

I'm attempting to customize the appearance of appointments on a calendar by assigning each appointment a specific color. I've been trying to add a top border to represent the color, but it's not displaying correctly. Can anyone spot what might be causing this issue?

Here is the JSX code snippet:

<div className={props.start >= moment() ? "appointment" : " appointment disabled"} style={props.color !== null ? {borderTopColor: props.color} :{borderTopColor: '#000'}}> 
</div>

Below are the SCSS classes related to appointments:

.appointment{
    width:105%;
    height:95%;
    background-color:$plain-white;
    margin-top:3% !important;
    margin-left:3%;
    border: 4px solid $plain-white;
    border-radius: 5px;
    padding:5px; 
    -webkit-box-shadow: 1px 5px 23px -2px rgba(199, 199, 199, 1);
    -moz-box-shadow: 1px 5px 23px -2px rgba(199, 199, 199, 1);
    box-shadow: 1px 5px 23px -2px rgba(199, 199, 199, 1);

    .service{
        text-align: center;
        font-weight: 700;
    }

}
.enable{
    cursor: pointer;
    border-top-color:#9DBBF5;
}
.disabled{
    pointer-events: none;
    border-color: $white;
    border-top-color: $black;
    background-color: $white;

}

Answer №1

There seems to be a small error in your code - you have mistakenly used borderColorTop instead of borderTopColor in the style property.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Dispatching an asynchronous function error in React with TypeScript and Redux - the parameter type is not assignable to AnyAction

Currently, I am in the process of developing a web application that utilizes Firebase as its database, along with Redux and TypeScript for state management. Within my code, I have a dispatch function nested inside a callback function like so: export const ...

Error in custom TypeScript: Incorrect error instance detected within the component

I encountered a unique issue with my custom Error export class CustomError extends Error{ constructor(message: string) { super(message); Object.setPrototypeOf(this, CustomError.prototype); this.name = "CustomError"; } Furthermore ...

Firefox behaving strangely when using outlines and pseudo-elements

When it comes to combining outline and pseudo-elements, Firefox has a unique behavior compared to Chrome and Safari (I haven't tested other browsers). Is this a bug or is there a way to resolve it? .main { position: relative; width: 100px; he ...

Building a responsive HTML5 site optimized for various screen sizes

I'm working on a website design that includes just one <div>. I have managed to make it responsive to different screen resolutions, but when testing it on a laptop, the horizontal and vertical scrollbars are automatically appearing. Does anyone ...

How can we determine when a row has been modified while using a list of floating-left LIs?

Check out this list of products for an example: I have a function that is triggered on document ready which goes through each item in the list and adjusts the height of a span wrapping the image to ensure uniform spacing. My question is, is it possible f ...

What is the best way to display data stored in local storage using React and Typescript?

Is there a way for the data to be displayed on the browser below the save button when I click save? My setup involves using React with a TypeScript template. function ButtonDefaultExample(props: IButtonExampleProps) { const { disabled, checked } = pro ...

Can I use the mouseover event on an image to display a sibling div?

Hi everyone! I'm fairly new to web development and I could really use some advice. I'm trying to implement a mouseenter event on an img tag to show a sibling div, but I'm encountering some strange behavior. The mouseenter event seems to be w ...

Adding code containing various Google Maps elements in a fresh browser window using JavaScript

I've encountered an issue while trying to create a new page with a Google map and title based on the button clicked. Interestingly, when I copy/paste the HTML in the "newhtml" variable into an actual HTML file, it works perfectly fine. However, it doe ...

Is it possible to integrate Joy UI and Material UI simultaneously?

I am working on a React project that currently utilizes Joy UI components. However, I also want to incorporate Material UI elements into the app. Is it possible to integrate Material UI and Joy UI within the same React application? If so, what is the best ...

When I refresh the browser with React Router in Laravel Mix, I'm faced with error 404

While I've come across several similar questions with different solutions, I still find them confusing. My goal is to dive deeper into React.js and Laravel to build various applications successfully. Header.js: Importing Files import React, { ...

How can I display a nested dropdown list within a form using JSON data in React?

Utilizing material ui and formik, I have integrated a form that requires a selection box with nested options to be displayed as shown in the image linked here. (The value selected needs to be submitted upon form submission) https://i.sstatic.net/02AI2.png ...

Is there a clash between ng-if and col col-50?

Currently, I am attempting to create a table using Angular code within HTML. The structure of the table is exactly how I want it to be, and here is the code snippet representing it: <div class="row"> <div class="col col-25">Date</div> ...

Creating a Higher Order Component (HOC) for your Next.js page

Upon running the following code, I encountered an error message Error: The default export is not a React Component in page: "/" pages/index.tsx import React, { useState, useRef } from "react"; import type { NextPage } from "next&q ...

When using React MUI Autocomplete, make sure to handle the error that occurs when trying to filter options using the

I am trying to implement an autocomplete search bar that makes a custom call to the backend to search through a list of tickers. <Autocomplete multiple id="checkboxes-tags-demo" options={watchlis ...

Struggling with removing the unattractive left border on my Tumblr page

I am currently working on the website www.fashiontogo.ca To see the source code, please use Google Chrome's feature to view the source since I cannot provide the HTML or CSS directly here. The site is not my own creation, and I did not develop it fro ...

Need to swiftly modify values of css attributes?

Here is a snippet of the code I am working with: <div></div> <button> Go </button> div { width: 50px; height: 50px; border: 1px solid #ccc; } var bgs = ['red', 'blue', 'yellow', 'green&apo ...

Achieve a full page layout with content and attach the footer to the bottom using flexbox in Tailwindcss and Nextjs

How can I use flex-grow to make the body section fill the screen and keep the nav fixed at the bottom? I'm having trouble figuring out which elements to apply these properties to. Can anyone provide guidance on which element should have these styles? ...

Menu with option to delete next to each selection item

My task is to create a drop-down menu with a delete 'X' option next to each item. This functionality should work even when the drop-down is dynamically populated, without resorting to using a list as an alternative. UPDATE: The icons next to eac ...

Looking to replicate a Modal that I designed, but unsure which elements need altering in order to achieve this. I am hoping to create three duplicates of the Modal

This modal is functioning perfectly, and now I want to replicate the same modal three times on a single page. I require three distinct buttons on the same page to trigger these separate modals. At this point, I am unsure which attributes need modification ...

Could someone confirm if this NextJS scss module is functioning correctly, or is there an issue on my end

Within my project, I am utilizing a pagination.tsx component in conjunction with a pagination.module.scss file which houses the following styles: .pagination { ul { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4p ...