kamrify commited on
Commit
d538d71
·
1 Parent(s): 464f70b

Rename CSS file to have same name

Browse files
docs/package.json CHANGED
@@ -16,7 +16,7 @@
16
  "@types/react": "^18.0.21",
17
  "@types/react-dom": "^18.0.6",
18
  "astro": "^2.7.0",
19
- "driver.js": "1.1.1-next.0",
20
  "react": "^18.0.0",
21
  "react-dom": "^18.0.0",
22
  "react-fast-marquee": "^1.6.0",
 
16
  "@types/react": "^18.0.21",
17
  "@types/react-dom": "^18.0.6",
18
  "astro": "^2.7.0",
19
+ "driver.js": "1.1.2-next.0",
20
  "react": "^18.0.0",
21
  "react-dom": "^18.0.0",
22
  "react-fast-marquee": "^1.6.0",
docs/pnpm-lock.yaml CHANGED
@@ -24,8 +24,8 @@ dependencies:
24
  specifier: ^2.7.0
25
  version: 2.7.0
26
  driver.js:
27
- specifier: 1.1.1-next.0
28
- version: 1.1.1-next.0
29
  react:
30
  specifier: ^18.0.0
31
  version: 18.2.0
@@ -1376,8 +1376,8 @@ packages:
1376
1377
  resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
1378
 
1379
- /[email protected].1-next.0:
1380
- resolution: {integrity: sha512-hXBZzvcVsU0MlNozeQbp3S49fUuPaKTDVNQe2hKK57nQCmr5WgCE3QVi2IgDMeEI6a+z7UDpbRnCHJt+Lt/NkQ==}
1381
  dev: false
1382
 
1383
 
24
  specifier: ^2.7.0
25
  version: 2.7.0
26
  driver.js:
27
+ specifier: 1.1.2-next.0
28
+ version: 1.1.2-next.0
29
  react:
30
  specifier: ^18.0.0
31
  version: 18.2.0
 
1376
1377
  resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
1378
 
1379
+ /[email protected].2-next.0:
1380
+ resolution: {integrity: sha512-2VrKUesC5Cs0OTSze2fhpkiHF4+wNxEwwOuD9AtCWiLDhtwc5En3ktHeP057yhSfEvaUQihffchylQ001zEPSQ==}
1381
  dev: false
1382
 
1383
docs/src/components/examples/SimpleHighlight.tsx CHANGED
@@ -1,15 +1,25 @@
1
  import { useEffect } from "react";
 
 
 
2
  import type { DriveStep } from "driver.js";
3
 
4
  type SimpleHighlightProps = {
5
- popover: DriveStep.Popover;
6
- }
 
 
 
 
 
 
 
 
 
7
 
8
- export function SimpleHighlight() {
9
- useEffect(() => {
10
- console.log('in browser');
11
- }, []);
12
  return (
13
- <button onClick={() => alert('sup')} className='w-full rounded-md bg-black p-2 text-white'>Highlight Something</button>
 
 
14
  );
15
- }
 
1
  import { useEffect } from "react";
2
+ import { Config, driver } from "driver.js";
3
+ import "driver.js/dist/style.css";
4
+
5
  import type { DriveStep } from "driver.js";
6
 
7
  type SimpleHighlightProps = {
8
+ config: Config;
9
+ step: DriveStep;
10
+ };
11
+
12
+ export function SimpleHighlight(props: SimpleHighlightProps) {
13
+ const { config, step } = props;
14
+
15
+ function onClick() {
16
+ const driverObj = driver(config);
17
+ driverObj.highlight(step);
18
+ }
19
 
 
 
 
 
20
  return (
21
+ <button onClick={onClick} className="w-full rounded-md bg-black p-2 text-white">
22
+ Highlight Something
23
+ </button>
24
  );
25
+ }
docs/src/content/guides/basic-usage.mdx CHANGED
@@ -8,19 +8,25 @@ import { SimpleHighlight } from "../../components/examples/SimpleHighlight.tsx";
8
 
9
  Once installed, you can import and start using the library. Given below is a simple example of how to highlight a single element.
10
 
11
- <div>
12
- ```js
13
- import Driver from 'driver.js';
14
- import 'driver.js/dist/driver.min.css';
15
 
16
- const driver = new Driver();
17
- driver.highlight({
18
  element: '#some-element',
19
  popover: {
20
- title: 'Title for the Popover',
21
- description: 'Description for it',
22
- },
23
  });
24
- ```
25
- <SimpleHighlight client:load />
 
 
 
 
 
 
26
  </div>
 
8
 
9
  Once installed, you can import and start using the library. Given below is a simple example of how to highlight a single element.
10
 
11
+ <div id="simple-example">
12
+ ```js
13
+ import Driver from 'driver.js';
14
+ import 'driver.js/dist/driver.min.css';
15
 
16
+ const driver = new Driver();
17
+ driver.highlight({
18
  element: '#some-element',
19
  popover: {
20
+ title: 'Title for the Popover',
21
+ description: 'Description for it',
22
+ },
23
  });
24
+ ```
25
+ <SimpleHighlight step={{
26
+ element: "#simple-example",
27
+ popover: {
28
+ title: "Title for the Popover",
29
+ description: "Description for it",
30
+ },
31
+ }} client:load />
32
  </div>
index.html CHANGED
@@ -338,6 +338,7 @@ npm install driver.js</pre
338
  </div>
339
  <script type="module">
340
  import { driver } from "./src/driver.ts";
 
341
 
342
  const basicTourSteps = [
343
  {
 
338
  </div>
339
  <script type="module">
340
  import { driver } from "./src/driver.ts";
341
+ import "./src/driver.css";
342
 
343
  const basicTourSteps = [
344
  {
package.json CHANGED
@@ -9,6 +9,10 @@
9
  ".": {
10
  "require": "./dist/driver.js.cjs",
11
  "import": "./dist/driver.js.mjs"
 
 
 
 
12
  }
13
  },
14
  "scripts": {
 
9
  ".": {
10
  "require": "./dist/driver.js.cjs",
11
  "import": "./dist/driver.js.mjs"
12
+ },
13
+ "./dist/*.css": {
14
+ "import": "./dist/*.css",
15
+ "require": "./dist/*.css"
16
  }
17
  },
18
  "scripts": {
src/{style.css → driver.css} RENAMED
File without changes
src/driver.ts CHANGED
@@ -4,8 +4,6 @@ import { destroyEvents, initEvents, requireRefresh } from "./events";
4
  import { Config, configure, getConfig } from "./config";
5
  import { destroyHighlight, highlight } from "./highlight";
6
  import { destroyEmitter, listen } from "./emitter";
7
-
8
- import "./style.css";
9
  import { getState, resetState, setState } from "./state";
10
 
11
  export type DriveStep = {
 
4
  import { Config, configure, getConfig } from "./config";
5
  import { destroyHighlight, highlight } from "./highlight";
6
  import { destroyEmitter, listen } from "./emitter";
 
 
7
  import { getState, resetState, setState } from "./state";
8
 
9
  export type DriveStep = {