forked from WinmezzZ/react-antd-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Winme
committed
Feb 7, 2020
1 parent
e0348dc
commit 3cbfaa7
Showing
18 changed files
with
282 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const enUS_avatorDropMenu = { | ||
'header.avator.account': 'Account', | ||
'header.avator.logout': 'Logout' | ||
'header.avator.logout': 'Logout', | ||
'global.theme.switchTheme': 'Switch Theme', | ||
'global.theme.switchingTheme': 'Switching Theme...', | ||
'global.theme.switchThemeDone': 'Update theme successfully!', | ||
'global.theme.switchThemeFail': 'Update theme fail' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const zhCN_avatorDropMenu = { | ||
'header.avator.account': '个人设置', | ||
'header.avator.logout': '退出登录' | ||
'header.avator.logout': '退出登录', | ||
'global.theme.switchTheme': '切换主题', | ||
'global.theme.switchingTheme': '切换主题中...', | ||
'global.theme.switchThemeDone': '主题更新成功', | ||
'global.theme.switchThemeFail': '主题更新失败' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@import '~src/styles/var'; | ||
|
||
.guide-page { | ||
.guide-intro { | ||
background-color: rgb(41, 42, 45); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { useEffect, useRef } from 'react' | ||
import Driver from 'driver.js' | ||
import 'driver.js/dist/driver.min.css' | ||
import './index.less' | ||
import { useLocale } from '~/locales' | ||
|
||
export const useGuide = () => { | ||
const { locale, formatMessage } = useLocale() | ||
|
||
const driver = useRef( | ||
new Driver({ | ||
keyboardControl: false, | ||
allowClose: false, | ||
overlayClickNext: true, | ||
opacity: 0.5, | ||
className: 'driver-overlay', | ||
closeBtnText: formatMessage({ id: 'app.guide.driverjs.closeBtnText' }), | ||
prevBtnText: formatMessage({ id: 'app.guide.driverjs.prevBtnText' }), | ||
nextBtnText: formatMessage({ id: 'app.guide.driverjs.nextBtnText' }), | ||
doneBtnText: formatMessage({ id: 'app.guide.driverjs.doneBtnText' }) | ||
}) | ||
) | ||
|
||
useEffect(() => { | ||
driver.current.defineSteps([ | ||
{ | ||
element: '#sidebar-trigger', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.sidebarTrigger.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.sidebarTrigger.description' }), | ||
position: 'bottom', | ||
offset: 10, | ||
isFirst: true | ||
} | ||
}, | ||
{ | ||
element: '#notice-center', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.notices.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.notices.description' }), | ||
position: 'bottom', | ||
offset: -160 | ||
} | ||
}, | ||
{ | ||
element: '#language-change', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.switchLanguages.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.switchLanguages.description' }), | ||
position: 'bottom', | ||
offset: -170 | ||
} | ||
}, | ||
{ | ||
element: '#pageTabs .ant-tabs-nav.ant-tabs-nav-animated', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.pageTabs.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.pageTabs.description' }), | ||
position: 'bottom', | ||
offset: 30 | ||
} | ||
}, | ||
{ | ||
element: '#pageTabs-actions svg', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.pageTabsActions.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.pageTabsActions.description' }), | ||
position: 'left' | ||
} | ||
}, | ||
{ | ||
element: '#switchTheme', | ||
popover: { | ||
title: formatMessage({ id: 'app.guide.driverStep.switchTheme.title' }), | ||
description: formatMessage({ id: 'app.guide.driverStep.switchTheme.description' }), | ||
position: 'left', | ||
isLast: true | ||
} | ||
} | ||
]) | ||
}, [formatMessage, locale]) | ||
|
||
const driverStart = () => { | ||
console.log('guide started') | ||
localStorage.setItem('newUser', 'false') | ||
driver.current.start() | ||
} | ||
|
||
return { | ||
driverStart | ||
} | ||
} | ||
|
||
export default useGuide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.