Uniswap / Uniswap/interface

darkTheme and lightTheme not found

Open
#3,372 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Bug Description
As per documentation there should be Dark and Light themes:
https://docs.uniswap.org/sdk/widgets/swap-widget#toggling-light-dark-mode

However, when using the provided example code it is not working:

ERROR in ./src/App.js 23:28-37
export 'darkTheme' (imported as 'darkTheme') was not found in '@uniswap/widgets' (possible exports: SUPPORTED_LOCALES, SwapWidget)
 @ ./src/index.js 7:0-24 11:33-36

ERROR in ./src/App.js 23:40-50
export 'lightTheme' (imported as 'lightTheme') was not found in '@uniswap/widgets' (possible exports: SUPPORTED_LOCALES, SwapWidget)
 @ ./src/index.js 7:0-24 11:33-36

My complete code:

import './App.css';
import { ethers } from "ethers";
import { darkTheme, lightTheme, Theme, SwapWidget } from '@uniswap/widgets'

const jsonRpcEndpoint = process.env.REACT_APP_RPC_ENDPOINT;
const provider = new ethers.providers.Web3Provider(window.ethereum);

let darkMode = true;

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <div classname="Uniswap">
          <SwapWidget
            provider={provider}
            jsonRpcEndpoint={jsonRpcEndpoint}
            // width={360}
            theme={darkMode ? darkTheme : lightTheme}
            />
        </div>
      </header>
    </div>
  );
}

export default App;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented example from the linked Swap Widget documentation in App.js and checking the exports available from @uniswap/widgets. Trace why darkTheme and lightTheme are absent from the package exports. Done means the documented imports build successfully and the theme example works as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.