UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

1 lines 4.2 kB
{"version":3,"sources":["../src/components/RestrictedAccess/RestrictedAccess.tsx"],"sourcesContent":["import Text from '../Text/Text';\nimport Button from '../Button/Button';\nimport { cn } from '../../utils/utils';\nimport { ShieldCheckIcon } from '@phosphor-icons/react/dist/csr/ShieldCheck';\nimport { getRootDomain } from '../Auth/Auth';\n\n/**\n * Props interface for the RestrictedAccess component\n *\n * @interface RestrictedAccessProps\n * @property {string} [title] - Custom title text (default: \"Área Restrita\")\n * @property {string} [description] - Custom description text\n * @property {string} [buttonText] - Custom button text (default: \"Fazer Login\")\n * @property {string} [logoSrc] - Logo image source URL\n * @property {string} [logoAlt] - Logo image alt text\n * @property {string} [footerText] - Footer text to display\n * @property {string} [className] - Additional CSS classes for the container\n */\nexport interface RestrictedAccessProps {\n title?: string;\n description?: string;\n buttonText?: string;\n logoSrc?: string;\n logoAlt?: string;\n footerText?: string;\n className?: string;\n}\n\n/**\n * RestrictedAccess component for displaying login/authentication required pages\n *\n * A reusable component for displaying restricted access pages with configurable\n * content, logo, and login action. Clicking the login button redirects to the\n * root domain using getRootDomain() (e.g., backoffice.example.com -> example.com).\n *\n * @param {RestrictedAccessProps} props - The component props\n * @returns {JSX.Element} The RestrictedAccess component\n *\n * @example\n * ```typescript\n * <RestrictedAccess\n * logoSrc=\"/logo.png\"\n * footerText=\"My Application\"\n * />\n * ```\n */\nconst RestrictedAccess = ({\n title = 'Área Restrita',\n description = 'Este é um painel administrativo. Faça login para acessar o sistema.',\n buttonText = 'Fazer Login',\n logoSrc,\n logoAlt = 'Logo',\n footerText,\n className = '',\n}: RestrictedAccessProps) => {\n const handleLoginClick = () => {\n globalThis.location.href = getRootDomain();\n };\n\n return (\n <div\n className={cn(\n 'min-h-screen w-full bg-primary-800 flex flex-col items-center justify-center p-4',\n className\n )}\n >\n <div className=\"flex flex-col items-center gap-8 max-w-md w-full\">\n {logoSrc && (\n <img src={logoSrc} alt={logoAlt} className=\"h-12 object-contain\" />\n )}\n\n <div className=\"bg-background rounded-xl p-8 w-full flex flex-col items-center gap-6 shadow-lg\">\n <div className=\"bg-primary-100 p-4 rounded-full\">\n <ShieldCheckIcon size={48} className=\"text-primary-800\" />\n </div>\n\n <div className=\"flex flex-col items-center gap-2 text-center\">\n <Text size=\"xl\" weight=\"bold\">\n {title}\n </Text>\n <Text size=\"md\" color=\"text-text-500\">\n {description}\n </Text>\n </div>\n\n <Button onClick={handleLoginClick} className=\"w-full\">\n {buttonText}\n </Button>\n </div>\n\n {footerText && (\n <Text size=\"sm\" color=\"text-primary-200\">\n {footerText}\n </Text>\n )}\n </div>\n </div>\n );\n};\n\nexport default RestrictedAccess;\n"],"mappings":";;;;;;;;;;;;;;AAGA,SAAS,uBAAuB;AAiEtB,cAQA,YARA;AAtBV,IAAM,mBAAmB,CAAC;AAAA,EACxB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,aAAa;AAAA,EACb;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,YAAY;AACd,MAA6B;AAC3B,QAAM,mBAAmB,MAAM;AAC7B,eAAW,SAAS,OAAO,cAAc;AAAA,EAC3C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA,+BAAC,SAAI,WAAU,oDACZ;AAAA,mBACC,oBAAC,SAAI,KAAK,SAAS,KAAK,SAAS,WAAU,uBAAsB;AAAA,QAGnE,qBAAC,SAAI,WAAU,kFACb;AAAA,8BAAC,SAAI,WAAU,mCACb,8BAAC,mBAAgB,MAAM,IAAI,WAAU,oBAAmB,GAC1D;AAAA,UAEA,qBAAC,SAAI,WAAU,gDACb;AAAA,gCAAC,gBAAK,MAAK,MAAK,QAAO,QACpB,iBACH;AAAA,YACA,oBAAC,gBAAK,MAAK,MAAK,OAAM,iBACnB,uBACH;AAAA,aACF;AAAA,UAEA,oBAAC,kBAAO,SAAS,kBAAkB,WAAU,UAC1C,sBACH;AAAA,WACF;AAAA,QAEC,cACC,oBAAC,gBAAK,MAAK,MAAK,OAAM,oBACnB,sBACH;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,2BAAQ;","names":[]}