All files / virtual-keyboard/src/layouts email.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35          1x                         1x                                
import { createLayout } from "../engine/createLayout";
import type { KeyDefinition } from "../types";
import { BACKSPACE_KEY, ENTER_KEY, SHIFT_KEY, SPACE_KEY } from "./qwerty";
 
function ck(key: string): KeyDefinition {
  return { key, type: "char" };
}
 
/**
 * An email-optimized QWERTY: no symbol layer, but dedicated `@` and `.com`
 * convenience keys on the bottom row for faster address entry.
 *
 * @example
 * ```tsx
 * import { VirtualKeyboard, emailLayout } from "@usefy/virtual-keyboard";
 * <VirtualKeyboard layouts={emailLayout} />;
 * ```
 */
export const emailLayout = createLayout({
  name: "email",
  label: "Email",
  rows: [
    ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
    ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
    [SHIFT_KEY, "z", "x", "c", "v", "b", "n", "m", BACKSPACE_KEY],
    [
      { key: "@", type: "char", width: 1.5 },
      ck("."),
      { key: ".com", label: ".com", type: "char", width: 1.5 },
      SPACE_KEY,
      ENTER_KEY,
    ],
  ],
});