ข้ามไปยังเนื้อหา

หน้าเข้าสู่ระบบ

SignInLayout

The sign-in page and the other pages before sign-in, such as the first-login password change. On wide screens the page splits in two: a brand panel with the logo, the system's name and a headline, and a white side with the form centred. On phones the brand panel becomes a compact header above the form. Its title is the page's one level 1 heading. Pass the fields and the button as children. Don't put it inside AppShell.

ใช้กับหน้าก่อนเข้าสู่ระบบ ได้แก่ หน้าเข้าสู่ระบบ และหน้าตั้งรหัสผ่านใหม่เมื่อเข้าสู่ระบบครั้งแรก จอกว้างแบ่งครึ่ง ซ้ายเป็นแผงสีหลักของแอปมีตรา ชื่อระบบ และหัวข้อ ขวาเป็นฟอร์มสีขาวอยู่กลางจอ บนโทรศัพท์แผงสีหลักของแอปย่อเป็นหัวหน้าเล็ก ๆ เหนือฟอร์ม ส่งช่องกรอกและปุ่มเป็น children ไม่ใช้ใน AppShell ดูวิธีใช้ทั้งหน้าที่หน้าตัวอย่างเข้าสู่ระบบ

import { SignInLayout } from "@bsru/ui";

ตัวอย่าง

เข้าสู่ระบบ

brand ให้ตรา ชื่อระบบ และชื่อมหาวิทยาลัย headline และ description อยู่ล่างแผงสีหลักของแอป title เป็น h1 หนึ่งเดียวของหน้า topAction วางปุ่มภาษาที่มุมขวาบน notice แสดงแถบระบบจำลอง

<SignInLayout
  brand={{ name: "BSRU ERP", caption: t("brand.university"), logo: "/bsru-logo.png", alt: t("brand.seal") }}
  headline={t("signIn.headline")}
  description={t("signIn.tagline")}
  title={t("signIn.title")}
  subtitle={t("signIn.subtitle")}
  topAction={<LanguageSwitch />}
  footer={t("signIn.forgot")}
  notice={demo ? t("shell.demo") : undefined}
>
  <form action={signIn} className="flex flex-col gap-4">
    <TextInput label="อีเมล" name="email" type="email" icon={Mail} autoComplete="username" required />
    <PasswordInput label="รหัสผ่าน" name="password" autoComplete="current-password" required />
    <Button tone="primary" type="submit" icon={LogIn} label="เข้าสู่ระบบ" wide />
  </form>
</SignInLayout>

หลายข้อความ

slides แทน headline และ description เมื่อมีมากกว่าหนึ่งข้อความ จุดด้านล่างสลับข้อความ ข้อความเลื่อนเองทุกเก้าวินาทีเฉพาะเมื่อผู้ใช้ไม่ได้ขอลดการเคลื่อนไหว และหยุดเมื่อกดจุด ถ้ามีภาพมหาวิทยาลัยที่ได้รับอนุญาต image วางภาพไว้ใต้สีหลักของแอปแบบโปร่ง

<SignInLayout
  brand={brand}
  slides={[
    { headline: t("signIn.slide1"), description: t("signIn.slide1Text") },
    { headline: t("signIn.slide2"), description: t("signIn.slide2Text") },
    { headline: t("signIn.slide3"), description: t("signIn.slide3Text") },
  ]}
  title={t("signIn.title")}
>
  <form action={signIn} className="flex flex-col gap-4">
    <TextInput label="อีเมล" name="email" type="email" icon={Mail} autoComplete="username" required />
    <PasswordInput label="รหัสผ่าน" name="password" autoComplete="current-password" required />
    <Button tone="primary" type="submit" icon={LogIn} label="เข้าสู่ระบบ" wide />
  </form>
</SignInLayout>

หลายข้อความ พร้อมภาพประกอบ

art ของแต่ละข้อความวางภาพประกอบไว้ระหว่างตรากับหัวข้อ บนจอกว้างเท่านั้น SignInFigure เป็นภาพสามมิติแบบไอโซเมตริกสี่แบบ connected คืองบประมาณ พัสดุ และบุคลากรส่งงานเข้าอาคารเดียว approval คือคำขอที่อนุมัติจากโทรศัพท์ไปถึงมหาวิทยาลัย audit คือบันทึกใหม่ที่ซ้อนเข้าสมุดบันทึก assistant คือผู้ช่วย AI ที่เชื่อมต่อ ERP ผ่าน MCP กดส่วนต่าง ๆ ของภาพได้ และลากเพื่อหมุนเล็กน้อย ภาพนำเข้าจาก ui/src/signin-figures ไม่ใช่จาก @bsru/ui

import { SignInFigure } from "@bsru/ui/src/signin-figures";

<SignInLayout
  brand={brand}
  slides={[
    { headline: t("signIn.slide1"), description: t("signIn.slide1Text"), art: <SignInFigure figure="connected" /> },
    { headline: t("signIn.slide2"), description: t("signIn.slide2Text"), art: <SignInFigure figure="approval" /> },
    { headline: t("signIn.slide3"), description: t("signIn.slide3Text"), art: <SignInFigure figure="audit" /> },
    { headline: t("signIn.slide4"), description: t("signIn.slide4Text"), art: <SignInFigure figure="assistant" /> },
  ]}
  title={t("signIn.title")}
>
  <form action={signIn} className="flex flex-col gap-4">
    <TextInput label="อีเมล" name="email" type="email" icon={Mail} autoComplete="username" required />
    <PasswordInput label="รหัสผ่าน" name="password" autoComplete="current-password" required />
    <Button tone="primary" type="submit" icon={LogIn} label="เข้าสู่ระบบ" wide />
  </form>
</SignInLayout>

props ทั้งหมด

ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้

SignInLayout props
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
brand* จำเป็นPageBrand—The logo, the system's name and a caption, at the top of the brand panel.
headlinestring—The brand panel's large headline, such as ระบบบริหารมหาวิทยาลัย. Ignored when slides is passed.
descriptionstring—One line under the headline, such as งบประมาณ พัสดุ บุคลากร ในที่เดียว. Ignored when slides is passed.
slidesreadonly SignInSlide[]—Several headlines for the brand panel, in order. With more than one, dots below them switch between them. They move on by themselves every nine seconds only when the person hasn't asked for reduced motion, and stop once a dot is pressed or while the pointer or focus is on the panel.
imagestring—A picture for the brand panel, such as a campus photo. It sits under a wash of the brand colour, so the text stays readable.
imageAltstring""The picture's alternative text. Leave it empty when the picture is only decoration, the default.
title* จำเป็นstring—The form's heading, the page's level 1 heading, such as เข้าสู่ระบบ.
subtitlestring—A short line under the title, such as what to sign in with.
children* จำเป็นReactNode—The form: an Alert for a failed attempt, the fields and the primary Button.
alternativesReactNode—Other ways to sign in, such as a secondary Button for the university account (SSO), shown below the form after an "or" divider.
topActionReactNode—One control at the top right, such as the language switch or a link back to the main site.
noticestring—The gold strip across the top of the page, for demo and test systems, such as ระบบจำลอง.

ชนิดข้อมูล

PageBrand

The system's logo and name, at the top of a page that has no app frame, such as the sign-in page.

PageBrand fields
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
name* จำเป็นstring—The system's name, such as BSRU ERP or BSRU ERP คอนโซลผู้ดูแลระบบ.
captionstring—A small line under the name, such as the university's name.
alt* จำเป็นstring—The logo's alternative text, such as ตรามหาวิทยาลัยราชภัฏบ้านสมเด็จเจ้าพระยา.
hrefstring—Makes the logo and name a link, such as to the home page. Leave it out on the sign-in page.

SignInSlide

One message on the sign-in page's brand panel.

SignInSlide fields
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
headline* จำเป็นstring—A short headline about the system, such as ระบบบริหารมหาวิทยาลัย.
descriptionstring—One line under the headline, such as งบประมาณ พัสดุ บุคลากร ในที่เดียว.
artReactNode—A figure for this message, shown in the brand panel between the logo and the headline on wide screens, such as a SignInFigure from ui/src/signin-figures. It is decoration, hidden from screen readers. Leave it out for none.

ข้อควรปฏิบัติ

  • ใช้ภาษาของหน้าจอกับทุกข้อความ แอปแปลเองด้วยไฟล์ข้อความ ส่วนคำของ SignInLayout เอง เช่น คำว่า หรือ และชื่อจุดสลับข้อความ เปลี่ยนตาม LangProvider
  • มี h1 หนึ่งเดียวคือ title แผงสีหลักของแอปไม่มีหัวข้อ ส่วนฟอร์มอยู่ใน main และเป็น region ที่ชื่อตาม title
  • จุดสลับข้อความสูง 44 พิกเซลเพื่อกดด้วยนิ้วได้ และใช้ aria-pressed บอกข้อความที่แสดงอยู่
  • ภาพประกอบเป็นของตกแต่ง ซ่อนจากโปรแกรมอ่านหน้าจอ ข้อความทุกอย่างอยู่ในหัวข้อและคำอธิบาย ภาพเคลื่อนไหวเองเฉพาะเมื่อผู้ใช้ไม่ได้ขอลดการเคลื่อนไหว
  • อย่าใส่ภาพที่มีบุคคลจริงในตัวอย่าง ภาพจริงของมหาวิทยาลัยต้องได้รับอนุญาตก่อน

ซอร์สโค้ด: ui/src/pages.tsx