“Bahan js berikutnya arah ui rtl” Kode Jawaban

Ubah arah di UI material

const theme = createMuiTheme({
  direction: 'rtl',
});
Stormy Starling

Bahan js berikutnya arah ui rtl

//_app.js
import { createTheme } from '@material-ui/core'
import App from 'next/app'
import { ThemeProvider } from 'styled-components'
import { create } from 'jss'
import rtl from 'jss-rtl'
import { StylesProvider, jssPreset } from '@mui/styles'
import { CacheProvider } from '@emotion/react'
import createCache from '@emotion/cache'
import rtlPlugin from 'stylis-plugin-rtl'
// Create rtl cache
const cacheRtl = createCache({key: 'muirtl',stylisPlugins: [rtlPlugin]})
// Create rtl theme
const theme = createTheme({direction: 'rtl'})
const jss = create({
  plugins: [...jssPreset().plugins, rtl()],
})
export default class MyApp extends App {
  render() {
    const { Component, pageProps } = this.props
    return (
      <ThemeProvider theme={theme}>
        <StylesProvider jss={jss}>
          <CacheProvider value={cacheRtl}>
            <Component {...pageProps} />
          </CacheProvider>
        </StylesProvider>
      </ThemeProvider>
    )
  }
}
//_document.js
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'
import stylisRTLPlugin from 'stylis-plugin-rtl'

export default class MyDocument extends Document {
  static getInitialProps({ renderPage }) {
    const sheet = new ServerStyleSheet()

    const page = renderPage(
      (App) => (props) =>
        sheet.collectStyles(
          <StyleSheetManager stylisPlugins={[stylisRTLPlugin]}>
            <App {...props} />
          </StyleSheetManager>
        )
    )

    const styleTags = sheet.getStyleElement()

    return { ...page, styleTags }
  }
  render() {
    return (
      <Html dir='rtl'>
        <Head>{this.props.styleTags}</Head>
        <body dir='rtl'>
          <Main />
          <NextScript />
        </body>
      </Html>
    )
  }
}
Lively Ladybird

Jawaban yang mirip dengan “Bahan js berikutnya arah ui rtl”

Pertanyaan yang mirip dengan “Bahan js berikutnya arah ui rtl”

Lebih banyak jawaban terkait untuk “Bahan js berikutnya arah ui rtl” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya