use react-tabs production build

pull/5370/head
yann300 3 years ago
parent a6d7203628
commit 4b2df98098
  1. 7
      apps/remix-ide/src/app/panels/tab-proxy.js
  2. 2
      apps/remix-ide/src/assets/js/react-tabs.production.min.js
  3. 6
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

@ -306,8 +306,13 @@ export class TabProxy extends Plugin {
} }
renderTabsbar () { renderTabsbar () {
window.React = React
const script = document.createElement('script')
script.type = 'text/javascript'
script.src = 'assets/js/react-tabs.production.min.js'
document.head.appendChild(script)
script.addEventListener('load', () => this.renderComponent())
this.el = document.createElement('div') this.el = document.createElement('div')
this.renderComponent()
return this.el return this.el
} }
} }

File diff suppressed because one or more lines are too long

@ -1,6 +1,5 @@
import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint-disable-line import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint-disable-line
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs' // import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'
import './remix-ui-tabs.css' import './remix-ui-tabs.css'
/* eslint-disable-next-line */ /* eslint-disable-next-line */
@ -18,7 +17,10 @@ export interface TabsUIApi {
active: () => string active: () => string
} }
declare var ReactTabs: any
export const TabsUI = (props: TabsUIProps) => { export const TabsUI = (props: TabsUIProps) => {
const { Tab, Tabs, TabList, TabPanel } = ReactTabs
const [selectedIndex, setSelectedIndex] = useState(-1) const [selectedIndex, setSelectedIndex] = useState(-1)
const currentIndexRef = useRef(-1) const currentIndexRef = useRef(-1)
const tabsRef = useRef({}) const tabsRef = useRef({})

Loading…
Cancel
Save