extends ../partials/page-templates/_layout.pug
include ../partials/mixins-demo/_nav-components.pug
include ../partials/mixins/_stepper.pug

mixin feature-tour-step(step, title, body, last = false)
  - var labels = ['First step', 'Second step', 'Third step', 'Fourth step']
  .feature-tour.theme--magenta.theme--dark(role="dialog" aria-modal="false" aria-labelledby="feature-tour-title-" + step aria-describedby="feature-tour-body-" + step tabindex="-1" style="top: 0; left: 0")
    .feature-tour__arrow(style="left: 3rem; bottom: calc(var(--feature-tour-arrow-size) / -2)")
    h2.feature-tour__title(id="feature-tour-title-" + step)= title
    .feature-tour__body(id="feature-tour-body-" + step)
      p= body
    p.screenreader-only(aria-live="polite") Step #{step} of 4
    +stepper(step, labels, title)
    .feature-tour__actions
      if last
        button.button.button--small(type="button") Done
      else
        button.button.button--small.button--icon.button--icon--right.icon-next(type="button") Next
        button.button.button--text.button--small(type="button") End the tour

block append variables
  -var active_nav_item = "components"
  -var sidebar = true
  - var page_title = "Component: Feature tour"


block content

  .page__content__block
    .text--stamp Component
    h1
      strong Feature
      | 
      | tour
    p A guided tour of new features. The tour shows one step at a time in a box that points to an element on the page. The box is magenta: use #[code .theme--magenta.theme--dark] on #[code .feature-tour]. The buttons and the step indicator in the box get the darker secondary magenta.

  .page__content__block
    h2.text--label-header Step
    p The box has a title, a text, a step indicator and the buttons. The step indicator is a #[a(href="stepper") stepper], which only shows the circles in the box: the labels are hidden. Keep the text for screen readers, e.g. in a #[code .screenreader-only] element with #[code aria-live="polite"]. A script places the box, and the arrow, next to the element that the step points to. The box is #[code position: absolute], and #[code --feature-tour-arrow-size] is the size of the arrow, so that the script can let it stick out of the box.
    div(style="position: relative; height: 24rem")
      +feature-tour-step(2, "Title of the tip", "Write a short description of the function, and tell the user what to do.")

  .page__content__block
    h2.text--label-header Last step
    p The last step only has the button that ends the tour.
    div(style="position: relative; height: 24rem")
      +feature-tour-step(4, "Follow what is new", "The changelog tells you about all the changes.", true)

  .page__content__block
    h2.text--label-header In the middle of the screen
    p A step without an element is shown in the middle of the screen with #[code .feature-tour--centered]. The box is then #[code position: fixed], and has no arrow.

  .page__content__block
    h2.text--label-header Spotlight
    p #[code .feature-tour-spotlight] dims the page around the elements that the step points to, and keeps the clicks away from the rest of the page. It has two layers: #[code .feature-tour-spotlight__overlay] dims the page, and #[code .feature-tour-spotlight__blocker] takes the clicks. Place it in the end of the body, together with the box. A script sets #[code clip-path] on both layers, with a hole for each element that the student can still use. The holes get no pointer events, so the elements can be clicked.

block sidebar

  +components-nav("feature-tour")
