Using incompatible style attributes with React-Awesome-Slider in Gatsby

I recently incorporated React Awesomeslider into my project, which is developed using Gatsby.js and Next.js, with Sanity.io as the CMS. The css styling is currently set up through post css.

https://github.com/rcaferati/react-awesome-slider

Following the documentation's recommendation, I included the plain css since I am not utilizing scss for this particular project.

Below is a snippet of my component:

import PropTypes from "prop-types";
import styles from "./Hero.module.css";
import client from "../../client";
import SimpleBlockContent from "../SimpleBlockContent";
import Cta from "../Cta";
import imageUrlBuilder from "@sanity/image-url";
import AutoplaySlider from "react-awesome-slider";
import AwesomeSliderStyles from "react-awesome-slider/dist/styles.css";
const builder = imageUrlBuilder(client);

function Hero(props) {
  const { heading, image, tagline, ctas } = props;

  const images = props.image;
  return (
    <div className={styles.root}>
      <div className={styles.content}>
        <h1 className={styles.title}>{heading}</h1>
        <div className={styles.tagline}>{tagline && <SimpleBlockContent blocks={tagline} />}</div>
        <AutoplaySlider
          play={true}
          cancelOnInteraction={false}
          interval={6000}
          style={AwesomeSliderStyles}
        >
          <div>
            {images.map((image) => (
              <img
                className={styles.image}
                src={builder.image(image).url()}
                className={styles.image}
                alt={heading}
              />
            ))}
          </div>
        </AutoplaySlider>
      </div>
    </div>
  );
}

Hero.propTypes = {
  heading: PropTypes.string,
  backgroundImage: PropTypes.object,
  tagline: PropTypes.array,
  ctas: PropTypes.arrayOf(PropTypes.object),
};

export default Hero;

Although all imports are successful and the slider shows up on the page, I encountered the following error in the console...

Warning: Unsupported style property awssld__timer--hidden. Did you mean awssld__timer-hidden?

In addition, none of the other css styles seem to be loading correctly. Has anyone faced this issue before?

Your assistance would be greatly appreciated.

Thank you

Answer №1

To incorporate external CSS files, simply append ?raw at the end of the CSS file path. For example:

import StylishButtonStyles from "react-stylish-button/dist/styles.css?raw";

More information can be found here 😊

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

What is the best way to display an income statement div with three elements in a vertical position once the screen reaches a medium width?

Can anyone help me create an income statement div with three elements that has a responsive layout? I want these elements to change from a horizontal display to a vertical one when there is limited space, especially on medium width screens. The initial la ...

The source of the image gets disrupted when it is not on the homepage

My images are stored in the directory images/icons/artist_default.png On the homepage, the image is displayed with this path: http://localhost:7777/images/icons/artist_default.png However, on a user's page like http://localhost:7777/user/giorgio-m ...

html how to delete the beginning and end of hr element

There is a <hr noshade> tag in my HTML code which does not have any effect on the web view. However, when I print it to a PDF file, it shows head and tail like this: https://i.stack.imgur.com/TaBAc.jpg Here is my CSS that applies styling when print ...

Tips for embedding `<Link />` into a button and setting up an event handler in React Router v6

I'm attempting to achieve the following: import Button from '@material-ui/core/Button'; import { Link } from "react-router-dom"; return ( <div className="App"> <header className="App-header"> <Button ...

Jest fails to pass when encountering tsx syntax errors

Currently, I am incorporating jest tests into my project. The project is comprised of both TypeScript (.ts) and TypeScript JSX (.tsx) files. Below is a snippet from my jest.config.js file. module.exports = { preset: "ts-jest", testEnvironment: "jsdom" ...

How can one determine if the contents of a div are in a "clipped" state while using overflow: hidden?

Is there a way to style a div differently when its contents are clipped due to overflow: hidden or overflow: scroll? Some browsers don't provide any indication that content can be scrolled through, hurting usability. While there is no :clipped pseudo ...

Differences between material-ui tables and HTML tables [ WARNING: Invalid element type]

What could be causing the error message: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. It's interesting that I encounter this error when using the material-u ...

Changing the font family for Bootstrap Glyphicons on a button

I have recently started using Bootstraps Glyphicons and encountered an issue while trying to insert text inside a button with a glyphicon icon: <button type="button" class="btn btn-default pull-left" data-toggle="collapse" data-bind="attr:{'href&a ...

Problem involving non-breaking spaces

After changing the font-family of my website from Gotham Pro to Gotham, I encountered an issue with the styling of numbers that were formatted using my currency formatter function. Strangely, when the &nbsp character is removed, everything appears to b ...

How can the navbar class be altered when there is a change in routes?

My navbar class is set to change based on scroll position Script <script> $(window).scroll(function () { if ($("#main-navbar").offset().top > 100) { $("#main-navbar").addClass("navbar-shrink"); } else { $(" ...

Enhance your website with a stylish drop-down menu from inc.com

I am trying to create a drop and hide menu effect similar to the one on Here is my current demo: http://jsfiddle.net/elementhttp/56ThC/ $("#1").mouseover(function(){ //alert("aaaaaaaaaa"); just for testing $(".block2").stop().fadeToggle(700 ...

Utilizing Bootstrap4 to achieve optimal layout of form components

In my current project, I am developing a form using Bootstrap4 with specific design requirements. Despite researching extensively on Bootstrap4 documentation and implementing various strategies like using tags, I have not achieved the desired outcome. Be ...

Is it possible to retrieve data from a promise using the `use` hook within a context?

Scenario In my application, I have a component called UserContext which handles the authentication process. This is how the code for UserProvider looks: const UserProvider = ({ children }: { children: React.ReactNode }) => { const [user, setUser] = ...

Do elements containing {visibility:hidden} properties exist within the HTML DOM structure?

Do HTML elements that have the css property visibility:hidden still exist within the DOM tree? ...

Text off-center in Bootstrap Badge

I'm struggling to find a way to center my text with the icon properly. This issue is only happening in Google Chrome. You can view the problem in action on this code snippet. @import url('https://fonts.googleapis.com/icon?family=Material+Icons ...

Add a click event listener to the body element using a button click, without causing it to trigger

What is the current situation: A button is clicked by the user The menu opens (list items display = block) The function to close the menu is connected to the <body> The function to close the menu is immediately triggered, causing the menu to close ...

Transferring state information from a JSX navigation bar to a JSX map component in React

I'm having trouble figuring out how to utilize React in order to pass the state of my navigation bar to my map component. Essentially, I am fetching a date from the navigation bar and need to use it within my map component to display certain elements ...

Attempting to refresh react typings; Encountering difficulty locating 'react' in the database

My React typings are currently mismatched with the version of React I am using in my project. The @types/react is at version 15.0.35, while my React version is 15.6.1. I attempted to update the typings by running: typings install [email protected] H ...

Resolve a container overflow problem within the footer section

Trying to adjust the footer (newsletter signup form) on this page to fall to the bottom of the page has been a challenge. The #container element appears to be larger than the body, causing layout issues. Any suggestions on how to resolve this? An image d ...

Transforming table headers in Rmarkdown ioslides

I am experimenting with creating a custom table format for tables generated using the ioslides_presentation output type in Rmarkdown with Rstudio Version 0.98.1028. However, I'm facing difficulty in modifying the styling of the table headers. Below i ...