1
- # react-browser-containers
1
+ # 🪟 react-browser-containers ✨
2
2
3
- React Browser "container" components library, with tabs functionality. The library currency provides two browser components: ` ChromeBrowser ` and ` ArcBrowser ` .
3
+ Customizable browser-like containers, with tabs functionality (React).
4
+
5
+ ``` bash
6
+ npm i @enhanced-jax/react-browser-containers
7
+ ```
4
8
5
9
![ npm] ( https://img.shields.io/npm/v/@enhanced-jax/react-browser-containers )
6
10
![ GitHub license] ( https://img.shields.io/github/license/EnhancedJax/react-browser-containers )
7
11
![ npm bundle size] ( https://img.shields.io/bundlephobia/min/@enhanced-jax/react-browser-containers )
8
12
9
- | ChromeBrowser | ArcBrowser |
10
- | :----------------------: | :-------------------: |
11
- | ![ ] ( ./images/chrome.jpg ) | ![ ] ( ./images/arc.jpg ) |
13
+ | ![ ] ( ./images/chrome.png ) ChromeBrowser | ![ ] ( ./images/arc.png ) ArcBrowser |
14
+ | :------------------------------------ : | :----------- -------------------: |
15
+ | ![ ] ( ./images/chrome.jpg ) | ![ ] ( ./images/arc.jpg ) |
12
16
13
17
You can use the components to demonstrate functionality with browsers, or as decorative elements in your project. The components are not designed to be used as actual browsers.
14
18
@@ -20,45 +24,40 @@ import { useState } from "react";
20
24
21
25
const App = () => {
22
26
const [tab , setTab ] = useState (0 );
23
-
24
- return (
25
- < ChromeBrowser
26
- tab= {tab}
27
- setTab= {setTab}
28
- tabs= {{
29
- name: " Tab 1" ,
30
- link: " /tab1" ,
31
- content: < div> Tab 1 Content< / div> ,
32
- }}
33
- >< / ChromeBrowser>
34
- );
27
+ const tabs = [
28
+ {
29
+ name: " Google" ,
30
+ link: " https://google.com" ,
31
+ content: < div> Content< / div> ,
32
+ icon: (
33
+ < img
34
+ src= " https://google.com/favicon.ico"
35
+ style= {{ width: " 100%" , height: " 100%" }}
36
+ / >
37
+ ),
38
+ },
39
+ ];
40
+
41
+ return < ChromeBrowser tab= {tab} setTab= {setTab} tabs= {tabs}>< / ChromeBrowser> ;
35
42
};
36
43
```
37
44
38
45
### Props
39
46
40
- ``` js
41
- export type ChromeBrowserProps = {
42
- theme ?: "light " | "dark "; // theme of the browser, default is light. The light and dark theme of ArcBrowser is the same.
43
- tabs ?: Array <{ // pages in the browser
44
- name : string ;
45
- link : string ; // decorative link in the URL bar
46
- content : React .ReactNode ; // content of the page
47
- icon : React .ReactNode ; // icon of the page. use w/h 100%.
48
- // tip: get fav icon from any site using https://www.domain.com/favicon.ico
49
- }> ;
50
- shadow?: boolean; // shadow of the browser, default is true
51
- useContentSize?: boolean; // default is false: browser will be the size of it's parent element. true: browser will be the size of it's content
52
- contentScroll?: boolean; // if content inside the container should be scrollable, default is true
53
- leftIcons?: React .ReactNode ; // leave empty for default icons
54
- rightIcons?: React .ReactNode ; // leave empty for default icons
55
- lightTheme?: Theme; // changes the light theme of the browser
56
- darkTheme?: Theme; // changes the dark theme of the browser
57
- children?: React .ReactNode ; // content displayed over all pages
58
- tab?: number;
59
- setTab?: (tab : number ) => void ;
60
- };
61
- ```
47
+ | Name | Type | Description |
48
+ | -------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
49
+ | theme | ` "light" \| "dark" ` | Theme of the browser, default is light. The light and dark theme of ArcBrowser is the same. |
50
+ | tabs | ` Array<{name: string;link: string;content: React.ReactNode;icon: React.ReactNode;}> ` | Pages in the browser. |
51
+ | shadow | ` boolean ` | Shadow of the browser, default is true. |
52
+ | useContentSize | ` boolean ` | Default is false: browser will be the size of its parent element. True: browser will be the size of its content. |
53
+ | contentScroll | ` boolean ` | If content inside the container should be scrollable, default is true. |
54
+ | leftIcons | ` React.ReactNode ` | Leave empty for default icons. |
55
+ | rightIcons | ` React.ReactNode ` | Leave empty for default icons. |
56
+ | lightTheme | ` Theme ` | Changes the light theme of the browser. |
57
+ | darkTheme | ` Theme ` | Changes the dark theme of the browser. |
58
+ | children | ` React.ReactNode ` | Content displayed over all pages. |
59
+ | tab | ` number ` | Active tab index. |
60
+ | setTab | ` (tab: number) => void ` | Function to set the active tab index. |
62
61
63
62
``` js
64
63
export default interface Theme {
0 commit comments