Skip to content
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

docs(picker): new documentation pages for picker and picker-legacy #3321

Merged
merged 15 commits into from Dec 14, 2023

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Dec 13, 2023

This PR is based on the feature work here: ionic-team/ionic-framework#28689

What Changed

  1. The v7 ion-picker was moved to ion-picker-legacy.
  • Deprecation notice was added to link to the v8 ion-picker.
  1. The ion-picker-internal component has a new docs page at ion-picker.
  2. New component playground examples were added for v8 ion-picker.
  • Basic: Simple usage of ion-picker
  • Prefix & Suffix: Showing how to slot content at the start or end of the picker column
  • Theming: Showing how to make use of the CSS variables and host-level styles on the ion-picker-column-option to customize the appearance.
  • Picker in Modal: Showing an example of using the ion-picker in an overlay. Demonstrates how to pass the selected data back to the presenting component.

Resources

New ion-picker docs: https://ionic-docs-git-sp-fw-5583-ionic1.vercel.app/docs/v8/api/picker

Legacy ion-picker-legacy docs: https://ionic-docs-git-sp-fw-5583-ionic1.vercel.app/docs/v8/api/picker-legacy

Copy link

vercel bot commented Dec 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2023 10:52pm

@sean-perkins sean-perkins marked this pull request as ready for review December 13, 2023 19:37
@sean-perkins sean-perkins requested a review from a team as a code owner December 13, 2023 19:37
@sean-perkins sean-perkins requested review from liamdebeasi and a team and removed request for a team December 13, 2023 19:37

<body>
<ion-app>
<ion-content>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, but I think the following demo looks a bit nicer:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Picker | Basic</title>
    <link rel="stylesheet" href="../../../common.css" />
    <script src="../../../common.js"></script>
    <script
      type="module"
      src="https://cdn.jsdelivr.net/npm/@ionic/core@7.5.8-dev.11702398696.1ab62ea9/dist/ionic/ionic.esm.js"
    ></script>
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/@ionic/core@7.5.8-dev.11702398696.1ab62ea9/css/ionic.bundle.css"
    />

    <style>
      ion-modal {
        --height: auto;

        align-items: end;
      }

      ion-picker {
        margin-bottom: var(--ion-safe-area-bottom);
      }
    </style>
  </head>

  <body>
    <ion-app>
      <ion-content>
        <div class="container">
          <ion-button id="open-modal">Open modal</ion-button>

          <ion-modal trigger="open-modal" is-open="true">
            <ion-toolbar>
              <ion-buttons slot="start">
                <ion-button onclick="modal.dismiss(null, 'cancel')">Cancel</ion-button>
              </ion-buttons>
              <ion-buttons slot="end">
                <ion-button onclick="modal.dismiss(currentValue, 'confirm')">Done</ion-button>
              </ion-buttons>
            </ion-toolbar>
            <ion-picker>
              <ion-picker-column value="javascript">
                <ion-picker-column-option value="" disabled="true">--</ion-picker-column-option>
                <ion-picker-column-option value="javascript">Javascript</ion-picker-column-option>
                <ion-picker-column-option value="typescript">Typescript</ion-picker-column-option>
                <ion-picker-column-option value="rust">Rust</ion-picker-column-option>
                <ion-picker-column-option value="c#">C#</ion-picker-column-option>
              </ion-picker-column>
            </ion-picker>
          </ion-modal>
        </div>
      </ion-content>
    </ion-app>
    <script>
      const modal = document.querySelector('ion-modal');

      let currentValue = 'javascript';

      modal.addEventListener('didDismiss', (event) => {
        console.log('didDismiss', JSON.stringify(event.detail));
      });

      const pickerColumn = document.querySelector('ion-picker-column');
      pickerColumn.addEventListener('ionChange', (event) => {
        currentValue = event.detail.value;
      });
    </script>
  </body>
</html>

Notable changes:

  1. Add bottom margin to the picker for safe area
  2. Used the "custom dialog" feature for modal to make the modal only as large as the content
  3. Removed the "initial-breakpoint" usage (I think this was left over from a previous attempt at using a sheet)
  4. Updated the modal style to align the modal to the bottom of the view

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before after
Screenshot 2023-12-13 at 4 01 13 PM Screenshot 2023-12-13 at 4 00 57 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Addressed here: 789540d

static/usage/v8/picker/basic/demo.html Outdated Show resolved Hide resolved
static/usage/v8/picker/prefix-suffix/demo.html Outdated Show resolved Hide resolved
static/usage/v8/picker/theming/css-properties/demo.html Outdated Show resolved Hide resolved
docs/api/picker-legacy.md Show resolved Hide resolved
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go once the following changes are made. Great work!

static/usage/v8/picker/prefix-suffix/angular.md Outdated Show resolved Hide resolved
static/usage/v8/picker/prefix-suffix/react.md Outdated Show resolved Hide resolved
static/usage/v8/picker/prefix-suffix/vue.md Outdated Show resolved Hide resolved
docs/api/picker.md Outdated Show resolved Hide resolved
@sean-perkins sean-perkins merged commit ee33c0b into feature-8.0 Dec 14, 2023
4 checks passed
@sean-perkins sean-perkins deleted the sp/FW-5583 branch December 14, 2023 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants