-
-
Notifications
You must be signed in to change notification settings - Fork 627
feat: new component tour #1875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rzzf
wants to merge
7
commits into
varletjs:dev
Choose a base branch
from
rzzf:feat-tour
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: new component tour #1875
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
71bebea
feat: new component tour
rzzf e71e7f2
style(tour): replace close button icon
rzzf 32c443e
feat(tour): indicator support click
rzzf 46bac08
style(tour): indicator inactive color adjustment
rzzf 8f0fe82
refactor(tour): refactor the API and visual design of tour
rzzf 72d20ea
test(tour): add cases
rzzf a4d9c5a
refactor(tour): refactor implementation logic and prop attribute naming
rzzf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
| export default { | ||
| '--tour-width': '280px', | ||
| '--tour-background': 'var(--color-surface-container-low)', | ||
| '--tour-border-radius': '3px', | ||
| '--tour-title-padding': '20px 20px 0', | ||
| '--tour-title-color': '#fff', | ||
| '--tour-title-font-size': 'var(--font-size-lg)', | ||
| '--tour-description-color': '#bbb', | ||
| '--tour-description-padding': '12px 20px', | ||
| '--tour-description-font-size': 'var(--font-size-md)', | ||
| '--tour-description-line-height': '24px', | ||
| '--tour-indicator-background-color': 'var(--color-surface-container-highest)', | ||
| '--tour-actions-padding': '0 12px 12px 20px', | ||
| '--tour-next-button-color': 'var(--color-primary)', | ||
| '--tour-prev-button-color': 'var(--color-primary)', | ||
| '--tour-close-button-right': '20px', | ||
| '--tour-close-button-top': '20px', | ||
| '--tour-primary-background': 'var(--color-primary)', | ||
| '--tour-primary-title-color': 'var(--color-on-primary)', | ||
| '--tour-primary-description-color': 'var(--color-on-info)', | ||
| '--tour-primary-indicator-background-color': 'rgba(255, 255, 255, 0.15)', | ||
| '--tour-primary-indicator-active-background-color': 'var(--color-on-primary)', | ||
| '--tour-primary-next-button-color': 'var(--color-on-primary)', | ||
| '--tour-primary-prev-button-color': 'var(--color-on-primary)', | ||
| } |
This file contains hidden or 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 hidden or 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,25 @@ | ||
| export default { | ||
| '--tour-width': '312px', | ||
| '--tour-background': 'var(--color-surface-container-high)', | ||
| '--tour-border-radius': '28px', | ||
| '--tour-title-padding': '24px 24px 0', | ||
| '--tour-title-color': 'var(--color-inverse-surface)', | ||
| '--tour-title-font-size': '20px', | ||
| '--tour-description-color': 'var(--color-on-surface-variant)', | ||
| '--tour-description-padding': '16px 24px 24px', | ||
| '--tour-description-font-size': 'var(--font-size-md)', | ||
| '--tour-description-line-height': '24px', | ||
| '--tour-indicator-background-color': 'var(--color-surface-container-low)', | ||
| '--tour-actions-padding': '0 24px 24px', | ||
| '--tour-next-button-color': 'var(--color-primary)', | ||
| '--tour-prev-button-color': 'var(--color-primary)', | ||
| '--tour-close-button-right': '24px', | ||
| '--tour-close-button-top': '28px', | ||
| '--tour-primary-background': 'var(--color-primary)', | ||
| '--tour-primary-title-color': 'var(--color-on-primary)', | ||
| '--tour-primary-description-color': 'var(--color-on-info)', | ||
| '--tour-primary-indicator-background-color': 'rgba(0, 0, 0, 0.15)', | ||
| '--tour-primary-indicator-active-background-color': 'var(--color-on-primary)', | ||
| '--tour-primary-next-button-color': 'var(--color-on-primary)', | ||
| '--tour-primary-prev-button-color': 'var(--color-on-primary)', | ||
| } |
This file contains hidden or 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 hidden or 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,25 @@ | ||
| export default { | ||
| '--tour-width': '312px', | ||
| '--tour-background': 'var(--color-surface-container-high)', | ||
| '--tour-border-radius': '28px', | ||
| '--tour-title-padding': '24px 24px 0', | ||
| '--tour-title-color': '#1D1B20', | ||
| '--tour-title-font-size': '20px', | ||
| '--tour-description-color': 'var(--color-on-surface-variant)', | ||
| '--tour-description-padding': '16px 24px 24px', | ||
| '--tour-description-font-size': 'var(--font-size-md)', | ||
| '--tour-description-line-height': '24px', | ||
| '--tour-indicator-background-color': 'var(--color-surface-container-low)', | ||
| '--tour-actions-padding': '0 24px 24px', | ||
| '--tour-next-button-color': 'var(--color-primary)', | ||
| '--tour-prev-button-color': 'var(--color-primary)', | ||
| '--tour-close-button-right': '24px', | ||
| '--tour-close-button-top': '28px', | ||
| '--tour-primary-background': 'var(--color-primary)', | ||
| '--tour-primary-title-color': 'var(--color-on-primary)', | ||
| '--tour-primary-description-color': 'var(--color-on-info)', | ||
| '--tour-primary-indicator-background-color': 'rgba(255, 255, 255, 0.15)', | ||
| '--tour-primary-indicator-active-background-color': 'var(--color-on-primary)', | ||
| '--tour-primary-next-button-color': 'var(--color-on-primary)', | ||
| '--tour-primary-prev-button-color': 'var(--color-on-primary)', | ||
| } |
This file contains hidden or 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,44 @@ | ||
| <template> | ||
| <div :class="n()"> | ||
| <div v-if="title || $slots['title']" :class="n('title')"> | ||
| <slot name="title">{{ title }}</slot> | ||
| </div> | ||
| <div v-if="description || $slots['default']" :class="n('description')"> | ||
| <slot>{{ description }}</slot> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { defineComponent, watch } from 'vue' | ||
| import { injectTour } from '../tour/provide' | ||
| import { createNamespace } from '../utils/components' | ||
| import { props } from './props' | ||
|
|
||
| const { name, n } = createNamespace('tour-step') | ||
|
|
||
| export default defineComponent({ | ||
| name, | ||
| props, | ||
| setup(props) { | ||
| const { updateStepProps } = injectTour() | ||
|
|
||
| watch( | ||
| props, | ||
| (value) => { | ||
| updateStepProps?.(value) | ||
| }, | ||
| { immediate: true }, | ||
| ) | ||
|
|
||
| return { | ||
| n, | ||
| } | ||
| }, | ||
| }) | ||
| </script> | ||
|
|
||
| <style lang="less"> | ||
| @import '../styles/common'; | ||
| @import './tourStep'; | ||
| </style> |
This file contains hidden or 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,12 @@ | ||
| import { withInstall, withPropsDefaultsSetter } from '../utils/components' | ||
| import { props as tourStepProps } from './props' | ||
| import TourStep from './TourStep.vue' | ||
|
|
||
| withInstall(TourStep) | ||
| withPropsDefaultsSetter(TourStep, tourStepProps) | ||
|
|
||
| export { tourStepProps } | ||
|
|
||
| export const _TourStepComponent = TourStep | ||
|
|
||
| export default TourStep |
This file contains hidden or 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,33 @@ | ||
| import { type PropType } from 'vue' | ||
| import { popupProps } from '../popup' | ||
| import { Placement } from '../tour/props' | ||
| import { pickProps } from '../utils/components' | ||
|
|
||
| export const props = { | ||
| target: [String, Object] as PropType<string | HTMLElement>, | ||
| title: String, | ||
| description: String, | ||
| placement: String as PropType<Placement>, | ||
| width: [Number, String], | ||
| overlay: { | ||
| type: Boolean, | ||
| default: undefined, | ||
| }, | ||
| arrow: { | ||
| type: Boolean, | ||
| default: undefined, | ||
| }, | ||
| closeable: { | ||
| type: Boolean, | ||
| default: undefined, | ||
| }, | ||
| prevButtonText: String, | ||
| nextButtonText: String, | ||
| prevButtonTextColor: String, | ||
| nextButtonTextColor: String, | ||
| prevButtonColor: String, | ||
| nextButtonColor: String, | ||
| contentClass: String, | ||
| contentStyle: Object, | ||
| ...pickProps(popupProps, ['overlayClass', 'overlayStyle']), | ||
| } | ||
This file contains hidden or 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,14 @@ | ||
| .var-tour-step { | ||
| &__title { | ||
| padding: var(--tour-title-padding); | ||
| color: var(--tour-title-color); | ||
| font-size: var(--tour-title-font-size); | ||
| } | ||
|
|
||
| &__description { | ||
| padding: var(--tour-description-padding); | ||
| color: var(--tour-description-color); | ||
| font-size: var(--tour-description-font-size); | ||
| line-height: var(--tour-description-line-height); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.