Skip to content

Commit

Permalink
Merge pull request #149 from jaipaljadeja/tailwind-merge
Browse files Browse the repository at this point in the history
chore: improved styling process with tailwind-merge
  • Loading branch information
barabanovro authored Apr 12, 2024
2 parents a2ac75b + f75df36 commit 6d0303b
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 46 deletions.
3 changes: 2 additions & 1 deletion components/Editor/EditorControls.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useRef } from 'react'

import { RiLinksLine, RiQuestionLine } from '@remixicon/react'
import cn from 'classnames'
import { Priority, useRegisterActions } from 'kbar'
import { OnChangeValue } from 'react-select'

import { Button, Input } from 'components/ui'

import { cn } from '../../util/styles'

import ExampleSelector from './ExampleSelector'

type SelectOption = {
Expand Down
3 changes: 1 addition & 2 deletions components/Editor/EditorFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useContext } from 'react'

import cn from 'classnames'

import { AppUiContext } from '../../context/appUiContext'
import { CairoVMApiContext } from '../../context/cairoVMApiContext'
import { cn } from '../../util/styles'
import KBarButton from '../KBar/Button'
import ThemeSelector from '../ThemeSelector'
import ToggleFullScreen from '../ToggleFullScreen'
Expand Down
8 changes: 4 additions & 4 deletions components/Editor/ExampleSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { useId } from 'react'
import { useId } from 'react'

import { RiFileCodeLine } from '@remixicon/react'
import cn from 'classnames'
import Select, {
components,
DropdownIndicatorProps,
StylesConfig,
GroupBase,
StylesConfig,
} from 'react-select'

import { cn } from '../../util/styles'
import { Button } from '../ui'

import { Examples, CairoExampleNames } from './examples'
import { CairoExampleNames, Examples } from './examples'

type SelectOption = {
value: number
Expand Down
2 changes: 1 addition & 1 deletion components/Editor/ExtraColumn.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useContext, useState } from 'react'

import { Editor as MonacoEditor, Monaco } from '@monaco-editor/react'
import cn from 'classnames'
import { editor } from 'monaco-editor'

import { CodeType } from '../../context/appUiContext'
import { CairoVMApiContext } from '../../context/cairoVMApiContext'
import { cn } from '../../util/styles'

import Header from './Header'
import { InstructionsTable } from './InstructionsTable'
Expand Down
5 changes: 2 additions & 3 deletions components/Editor/InstructionRow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useState, forwardRef, ForwardedRef, useCallback } from 'react'

import cn from 'classnames'
import { ForwardedRef, forwardRef, useCallback, useState } from 'react'

import { toHex } from '../../util/string'
import { cn } from '../../util/styles'

type RowProps = {
instructionId: number
Expand Down
3 changes: 2 additions & 1 deletion components/Editor/InstructionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { memo, useCallback, useEffect, useRef } from 'react'

import cn from 'classnames'
import ReactTooltip from 'react-tooltip'
import { TableVirtuoso, TableVirtuosoHandle } from 'react-virtuoso'
import { IInstruction } from 'types'
Expand All @@ -9,6 +8,8 @@ import { CodeType } from 'context/appUiContext'

import { SierraVariables } from 'components/Tracer'

import { cn } from '../../util/styles'

const sierraVariableRe = /\[(\d+)\]/

export const InstructionsTable = ({
Expand Down
6 changes: 3 additions & 3 deletions components/Editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
useCallback,
useContext,
useEffect,
Expand All @@ -8,8 +8,7 @@ import React, {
} from 'react'

import { decode, encode } from '@kunigi/string-compression'
import { Editor as MonacoEditor, useMonaco, Monaco } from '@monaco-editor/react'
import cn from 'classnames'
import { Editor as MonacoEditor, Monaco, useMonaco } from '@monaco-editor/react'
import copy from 'copy-to-clipboard'
import { Priority, useRegisterActions } from 'kbar'
import { editor } from 'monaco-editor'
Expand All @@ -31,6 +30,7 @@ import { Examples } from 'components/Editor/examples'
import { Tracer } from 'components/Tracer'

import { AppUiContext, CodeType, LogType } from '../../context/appUiContext'
import { cn } from '../../util/styles'

import { ArgumentsHelperModal } from './ArgumentsHelperModal'
import { registerCairoLanguageSupport } from './cairoLangConfig'
Expand Down
3 changes: 2 additions & 1 deletion components/KBar/ResultItem.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { forwardRef } from 'react'

import cn from 'classnames'
import { Action } from 'kbar'

import { cn } from '../../util/styles'

type Props = {
action: Action
active: boolean
Expand Down
3 changes: 2 additions & 1 deletion components/NavLink.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react'

import cn from 'classnames'
import Link from 'next/link'

import { cn } from '../util/styles'

type Props = {
href: string
external?: boolean
Expand Down
1 change: 1 addition & 0 deletions components/Tracer/ExecutionStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { Priority, useRegisterActions } from 'kbar'

import { Button } from 'components/ui'

import { TraceEntry } from '.'

const ExecutionStatus = ({
Expand Down
20 changes: 11 additions & 9 deletions components/Tracer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {
memo,
useContext,
useEffect,
useState,
useRef,
useReducer,
memo,
useRef,
useState,
} from 'react'

import cn from 'classnames'
import { Priority, useRegisterActions } from 'kbar'
import { TableVirtuoso, TableVirtuosoHandle } from 'react-virtuoso'

import {
CairoVMApiContext,
BreakPoints,
CairoVMApiContext,
ProgramExecutionState,
} from 'context/cairoVMApiContext'

import { cn } from '../../util/styles'
import Console from '../Editor/Console'

import ExecutionStatus from './ExecutionStatus'
Expand Down Expand Up @@ -222,28 +222,30 @@ export const Tracer = () => {
<div className="px-4">
<nav className="-mb-px uppercase flex space-x-8" aria-label="Tabs">
<button
className={`hover:text-gray-700 whitespace-nowrap border-b py-1 mt-2 mb-4 text-xs font-thin ${cn(
className={cn(
'hover:text-gray-700 whitespace-nowrap border-b py-1 mt-2 mb-4 text-xs font-thin',
{
'border-indigo-600 text-gray-700':
selectedConsoleTab === IConsoleTab.DebugInfo,
'border-transparent text-gray-500':
selectedConsoleTab !== IConsoleTab.DebugInfo,
},
)}`}
)}
onClick={() => setSelectedConsoleTab(IConsoleTab.DebugInfo)}
>
Debug Info [d]
</button>
<button
onClick={() => setSelectedConsoleTab(IConsoleTab.Console)}
className={`hover:text-gray-700 whitespace-nowrap border-b py-1 mt-2 mb-4 text-xs font-thin ${cn(
className={cn(
'hover:text-gray-700 whitespace-nowrap border-b py-1 mt-2 mb-4 text-xs font-thin',
{
'border-indigo-600 text-gray-700':
selectedConsoleTab === IConsoleTab.Console,
'border-transparent text-gray-500':
selectedConsoleTab !== IConsoleTab.Console,
},
)}`}
)}
>
Console [e]
</button>
Expand Down
5 changes: 3 additions & 2 deletions components/layouts/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { useContext, PropsWithChildren } from 'react'
import { PropsWithChildren, useContext } from 'react'

import { GoogleAnalytics } from '@next/third-parties/google'
import cn from 'classnames'
import type { NextPage } from 'next'
import Head from 'next/head'

import { AppUiContext } from 'context/appUiContext'

import { getAbsoluteURL } from 'util/browser'

import { cn } from '../../util/styles'

import Footer from './Footer'
import Nav from './Nav'

Expand Down
3 changes: 2 additions & 1 deletion components/layouts/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cn from 'classnames'
import Link from 'next/link'

import { GITHUB_REPO_URL } from 'util/constants'
Expand All @@ -10,6 +9,8 @@ import ToggleFullScreen from 'components/ToggleFullScreen'
import ToggleThreeColumnLayout from 'components/ToggleThreeColumnLayout'
import { Container, Logo } from 'components/ui'

import { cn } from '../../util/styles'

const Nav = () => {
return (
<nav
Expand Down
3 changes: 2 additions & 1 deletion components/ui/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react'

import cn from 'classnames'
import ReactTooltip from 'react-tooltip'

import { cn } from '../../util/styles'

type Props = {
children: React.ReactNode | string
href?: string
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
children: React.ReactNode
Expand Down
3 changes: 2 additions & 1 deletion components/ui/Doc.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react'

import cn from 'classnames'
import Link from 'next/link'

import { cn } from '../../util/styles'

// The mark identifying an empty table cell, in order to avoid applying styles
const EMPTY_MARK = '*'

Expand Down
2 changes: 1 addition & 1 deletion components/ui/Hamburger.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/no-unknown-property */
import React from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
isActive?: boolean
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
children: React.ReactNode
Expand Down
4 changes: 2 additions & 2 deletions components/ui/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, ForwardedRef, forwardRef } from 'react'
import React, { ForwardedRef, forwardRef, useState } from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
searchable?: boolean
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Message.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
type: 'success' | 'warning' | 'error'
Expand Down
2 changes: 1 addition & 1 deletion components/ui/StackBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import cn from 'classnames'
import { cn } from '../../util/styles'

type Props = {
value: string
Expand Down
32 changes: 25 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"assert": "^2.0.0",
"babel-preset-es2020": "^1.0.2",
"bn.js": "^5.2.1",
"classnames": "^2.3.1",
"clsx": "^2.1.0",
"copy-to-clipboard": "^3.3.1",
"events": "^3.3.0",
"gray-matter": "^4.0.3",
Expand All @@ -48,6 +48,7 @@
"react-tooltip": "^4.2.21",
"react-use-id": "^1.0.0",
"react-virtuoso": "^4.7.7",
"tailwind-merge": "^2.2.2",
"vercel": "^33.2.0",
"wrangler": "^3.24.0"
},
Expand Down
Loading

0 comments on commit 6d0303b

Please sign in to comment.