fleet/frontend/components/TooltipWrapper
Sarah Gillespie 80137dfcc6
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340

# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).

---------

Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 11:09:53 +01:00
..
_styles.scss fix for tooltip wrapper text alignment (#15755) 2023-12-21 14:43:18 -06:00
index.tsx New tooltips! (#4326) 2022-02-28 13:25:06 -08:00
README.md UI – refactor forms and form fields (#16159) 2024-01-18 10:48:44 -05:00
TooltipWrapper.stories.tsx Refactor Tooltip Wrapper (#13845) 2023-11-07 13:15:49 -08:00
TooltipWrapper.tsx Update UI for software self-service features (#19244) 2024-05-31 11:09:53 +01:00

Tooltips Notes

This tooltip component was created to allow any content to be shown as a tooltip. You can place any JSX inside of the tipContent prop. Also, very important, the TooltipWrapper is designed ONLY to wrap text so make sure to use static text or text returned from a function.

Use cases

  1. As its own component
  2. Within a form input element

Examples

As its own component (Basic)

<TooltipWrapper tipContent="After hovering, you will see this.">
  The base text that contains the hover state
</TooltipWrapper>

As its own component (Advanced)

You can even make the tooltip more dynamic HTML:

<TooltipWrapper
  tipContent={
    <>
    The "snapshot" key includes the query's results. 
    <br />
    These will be unique to your query.
    </>
  }
>
  The data sent to your configured log destination will look similar
  to the following JSON:
</TooltipWrapper>

Within a form input element

Inside a form input element, you only need to specify a tooltip prop for the input. This can be any JSX as mentioned before.

<InputField
  label="Password"
  error={errors.password}
  name="password"
  onChange={onInputChange("password")}
  placeholder="Password"
  value={password || ""}
  type="password"
  helpText= "Must include 12 characters, at least 1 number (e.g. 0 - 9), and at least 1 symbol (e.g. &*#)"
  blockAutoComplete
  tooltip={
    <>
      This password is temporary. This user will be asked to set a new password after logging in to the Fleet UI.<br /><br />
      This user will not be asked to set a new password after logging in to fleetctl or the Fleet API.
    </>
  }
/>