Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor style problem: can not override --ti-cursor-font-size css variable #348

Open
m19v opened this issue Apr 15, 2023 · 0 comments
Open

Comments

@m19v
Copy link

m19v commented Apr 15, 2023

In React project, I am having an issue with cursor's style, when I pass html tag with class as an argument to type() function.
I can not override css variable introduced in root (e.g. --ti-cursor-font-size) locally in my css class . It affects font style but NOT cursor style.

import { renderToStaticMarkup } from "react-dom/server";
import TypeIt from "typeit-react";
import styles from "./index.module.css";
import "./styles.css";

export default function App() {
  const spanClass = styles.myReactClass;

  return (
    <>
      <TypeIt className={styles.myReactClass}>
        Cursor OK, CSS class:myReactClass TypeIt: without instance!
      </TypeIt>
      <TypeIt
        getBeforeInit={(instance) => {
          instance
            // .break({ delay: 750 })
            // .type('<span class="myClass">Hello World!</span>')
            .break({ delay: 750 })
            .type(
              `<span class="${spanClass}">Cursor NOK, CSS class:myReactClass; TypeIt: with instance; type func: 1!</span>`
            )
            .break({ delay: 750 })
            .type(
              renderToStaticMarkup(
                <span className={styles.myAnotherReactClass}>
                  Cursor NOK, CSS class:myAnotherReactClass; TypeIt: without
                  instance; type func: 2!
                </span>
              )
            );
          return instance;
        }}
      />
    </>
  );
}

For further details please check the question I posted on StackOverflow and for visual effect of the error here.

@m19v m19v changed the title Cursor position and animation is not working with html tag Cursor style problem: can not override --ti-cursor-font-size css variable Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant