1.0.13 • Published 4 years ago
swrec-menu v1.0.13
swrec-menu
swrec-menu
Install
npm install --save swrec-menu
Usage
props:
- withSSO={true} - в случае если нужно передать sso
- sso=
{
userData: {
displayName: string,
organizations: [
{
displayName: string
}
]
},
login: func,
logout: func,
logged: bool
}
под организацией пользователя выберется первый объект из массива organizations
- showLogin={false} - в зависимости от значения показывает кнопку входа (default: true)
- langUrls - ссылки для переадресации при выборе языка
- notificationComponent - переданный компонент уведомлений, которым будет заменен обычный компонент уведомлений. В случае если не передан, то показывается обычный компонент уведомлений.
- initConfig - конфиг для UidmProvider
import React from 'react'
import styled from 'styled-components'
import { UidmProvider, withUidmSSO } from 'uidm-react-lib'
import { Header, Footer } from 'swrec-menu'
const Container = styled.div`
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 400;
src: url(https://myexportrf.ru/local/templates/.default/fonts/Roboto-Regular.b9077621.eot);
src: url(https://myexportrf.ru/local/templates/.default/fonts/Roboto-Regular.b9077621.eot) format('embedded-opentype'),
url(https://myexportrf.ru/local/templates/.default/fonts/Roboto-Regular.9feb0110.woff2) format('woff2'),
url(https://myexportrf.ru/local/templates/.default/fonts/Roboto-Regular.94dac78e.woff) format('woff');
}
`
const ExampleComponent = withUidmSSO(({ sso }) => {
const someComponent = () => <span>Здесь должны быть уведомления</span>
return (
<Container>
<Header
notificationComponent={someComponent}
withSSO
sso={sso}
onChangeCity={(city) => {console.log(city)}}
/>
<div style={{marginBottom: '500px'}}></div>
<Footer text="Create React Library Example 😄" />
</Container>
)
})
const App = () =>
<UidmProvider
key={1}
initConfig={{
clientId: 'portal',
ssoBaseUrl: 'https://lk.myexportrf.ru',
oauthConsumerBaseUrl: 'https://lk.myexportrf.ru',
useOauthConsumerBaseUrl: true,
useModalLogin: true,
gotoUrl: 'https://www.myexportrf.ru',
gotoOnFailUrl: 'https://www.myexportrf.ru'
}}
>
<ExampleComponent />
</UidmProvider>
export default App