uibee 2.16.7 → 2.16.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ type BubbleText = {
2
+ href: string;
3
+ className: string;
4
+ fill: string;
5
+ stroke: string;
6
+ text: string;
7
+ };
8
+ export default function Bubble({ href, className, fill, stroke, text }: BubbleText): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export default function Bubble({ href, className, fill, stroke, text }) {
3
+ return (_jsxs("a", { href: href, className: className, children: [_jsxs("svg", { viewBox: '0 0 24 12', className: 'absolute -top-[0.68rem] right-6 h-3 w-6', "aria-hidden": 'true', children: [_jsx("path", { d: 'M12 0 24 12H0Z', fill: fill, stroke: stroke, strokeWidth: '1.5', strokeLinejoin: 'round' }), _jsx("path", { d: 'M12 0 24 12H0Z', fill: fill })] }), _jsx("span", { children: text })] }));
4
+ }
@@ -1,5 +1,13 @@
1
1
  import React from 'react';
2
2
  import { Language } from 'uibee/components';
3
+ type BubbleContent = {
4
+ condition: boolean;
5
+ href: string;
6
+ className: string;
7
+ text: string;
8
+ fill: string;
9
+ stroke: string;
10
+ };
3
11
  export type NavbarProps = {
4
12
  lang?: Language;
5
13
  disableLanguageToggle?: boolean;
@@ -13,5 +21,11 @@ export type NavbarProps = {
13
21
  className?: string;
14
22
  innerClassName?: string;
15
23
  children: React.ReactNode;
24
+ bubble: {
25
+ lang?: BubbleContent;
26
+ theme?: BubbleContent;
27
+ login?: BubbleContent;
28
+ };
16
29
  };
17
- export default function Navbar({ lang, onlyLogo, disableLanguageToggle, disableThemeToggle, token, profilePath, loginPath, logoutPath, className, innerClassName, children, }: NavbarProps): import("react/jsx-runtime").JSX.Element;
30
+ export default function Navbar({ lang, onlyLogo, disableLanguageToggle, disableThemeToggle, token, profilePath, loginPath, logoutPath, className, innerClassName, children, bubble }: NavbarProps): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -6,18 +6,19 @@ import LogoSmall from '../logo/logoSmall';
6
6
  import LanguageToggle from '../toggle/language';
7
7
  import ThemeToggle from '../toggle/theme';
8
8
  import { LogOut, User } from 'lucide-react';
9
+ import Bubble from './bubble';
9
10
  function hamburgerStyle(isOpen, isSecond) {
10
11
  return `bg-login-50 h-0.5 absolute w-8 transition-all duration-[400ms] left-2 ${isOpen
11
12
  ? `top-6 ${isSecond ? 'rotate-45' : '-rotate-45'}`
12
13
  : isSecond ? 'top-7' : 'top-4'}`;
13
14
  }
14
- export default function Navbar({ lang, onlyLogo, disableLanguageToggle, disableThemeToggle, token, profilePath, loginPath, logoutPath, className, innerClassName, children, }) {
15
+ export default function Navbar({ lang, onlyLogo, disableLanguageToggle, disableThemeToggle, token, profilePath, loginPath, logoutPath, className, innerClassName, children, bubble }) {
15
16
  const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
16
17
  return (_jsx("div", { className: `${isMobileMenuOpen ? 'bg-[#181818f0]' : 'bg-[#18181899]'} backdrop-blur-xl fixed top-0 z-900 w-full ${className}`, children: _jsxs("div", { className: `flex w-full max-w-6xl m-auto p-2 transition duration-500 800px:justify-between 800px:p-4 ${isMobileMenuOpen ? 'h-screen bg-login-900/20 800px:h-20' : ''} ${innerClassName}
17
18
  `, children: [_jsx("div", { className: 'block h-12 p-1 800px:p-0', children: _jsx(Link, { href: '/', onClick: () => setIsMobileMenuOpen(false), children: _jsx(LogoSmall, {}) }) }), onlyLogo ? null : (_jsxs(_Fragment, { children: [_jsx("nav", { className: 'hidden 800px:flex 800px:justify-between 800px:items-center 800px:w-fill max-w-200', children: children }), _jsxs("nav", { className: 'flex w-[calc(100vw-8rem)] justify-end h-12 800px:w-fit', children: [!disableThemeToggle &&
18
- _jsx(ThemeToggle, {}), !disableLanguageToggle &&
19
- _jsx(LanguageToggle, { language: lang }), loginPath && logoutPath &&
20
- _jsx(AuthButton, { profilePath: profilePath, token: token, loginPath: loginPath, logoutPath: logoutPath })] }), _jsxs("button", { className: 'w-12 h-12 relative cursor-pointer bg-none border-none 800px:hidden', onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen), children: [_jsx("div", { className: hamburgerStyle(isMobileMenuOpen) }), _jsx("div", { className: hamburgerStyle(isMobileMenuOpen, true) })] }), _jsx("nav", { className: `fixed top-16 w-[calc(100%-2rem)] max-w-140 mx-auto left-0 right-0 800px:hidden
19
+ _jsx(ThemeToggle, {}), bubble.theme?.condition && _jsx(Bubble, { href: bubble.theme.href, className: bubble.theme.className, text: bubble.theme.text, fill: bubble.theme.fill, stroke: bubble.theme.stroke }), !disableLanguageToggle &&
20
+ _jsx(LanguageToggle, { language: lang }), bubble.lang?.condition && _jsx(Bubble, { href: bubble.lang.href, className: bubble.lang.className, text: bubble.lang.text, fill: bubble.lang.fill, stroke: bubble.lang.stroke }), loginPath && logoutPath &&
21
+ _jsx(AuthButton, { profilePath: profilePath, token: token, loginPath: loginPath, logoutPath: logoutPath }), bubble.login?.condition && _jsx(Bubble, { href: bubble.login.href, className: bubble.login.className, text: bubble.login.text, fill: bubble.login.fill, stroke: bubble.login.stroke })] }), _jsxs("button", { className: 'w-12 h-12 relative cursor-pointer bg-none border-none 800px:hidden', onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen), children: [_jsx("div", { className: hamburgerStyle(isMobileMenuOpen) }), _jsx("div", { className: hamburgerStyle(isMobileMenuOpen, true) })] }), _jsx("nav", { className: `fixed top-16 w-[calc(100%-2rem)] max-w-140 mx-auto left-0 right-0 800px:hidden
21
22
  transition-all duration-500 ease-in-out overflow-hidden
22
23
  ${isMobileMenuOpen ? 'max-h-[calc(100vh-4rem)] opacity-100' : 'max-h-0 opacity-0'}`, onClick: () => setIsMobileMenuOpen(false), children: React.Children.map(children, (child, index) => (_jsx("div", { className: `transition-all duration-500 ease-out ${isMobileMenuOpen
23
24
  ? 'opacity-100 transform translate-y-0'
@@ -333,6 +333,9 @@
333
333
  .end {
334
334
  inset-inline-end: var(--spacing);
335
335
  }
336
+ .-top-\[0\.68rem\] {
337
+ top: calc(0.68rem * -1);
338
+ }
336
339
  .top-0 {
337
340
  top: calc(var(--spacing) * 0);
338
341
  }
@@ -366,6 +369,9 @@
366
369
  .right-4 {
367
370
  right: calc(var(--spacing) * 4);
368
371
  }
372
+ .right-6 {
373
+ right: calc(var(--spacing) * 6);
374
+ }
369
375
  .bottom-0 {
370
376
  bottom: calc(var(--spacing) * 0);
371
377
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "2.16.7",
3
+ "version": "2.16.8",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -0,0 +1,35 @@
1
+ type BubbleText = {
2
+ href: string
3
+ className: string
4
+ fill: string
5
+ stroke: string
6
+ text: string
7
+ }
8
+
9
+ export default function Bubble({ href, className, fill, stroke, text }: BubbleText) {
10
+ return (
11
+ <a
12
+ href={href}
13
+ className={className}
14
+ >
15
+ <svg
16
+ viewBox='0 0 24 12'
17
+ className='absolute -top-[0.68rem] right-6 h-3 w-6'
18
+ aria-hidden='true'
19
+ >
20
+ <path
21
+ d='M12 0 24 12H0Z'
22
+ fill={fill}
23
+ stroke={stroke}
24
+ strokeWidth='1.5'
25
+ strokeLinejoin='round'
26
+ />
27
+ <path
28
+ d='M12 0 24 12H0Z'
29
+ fill={fill}
30
+ />
31
+ </svg>
32
+ <span>{text}</span>
33
+ </a>
34
+ )
35
+ }
@@ -7,7 +7,16 @@ import LanguageToggle from '@components/toggle/language'
7
7
  import ThemeToggle from '@components/toggle/theme'
8
8
  import { Language } from 'uibee/components'
9
9
  import { LogOut, User } from 'lucide-react'
10
+ import Bubble from './bubble'
10
11
 
12
+ type BubbleContent = {
13
+ condition: boolean
14
+ href: string
15
+ className: string
16
+ text: string
17
+ fill: string
18
+ stroke: string
19
+ }
11
20
 
12
21
  function hamburgerStyle (isOpen: boolean, isSecond?: boolean) {
13
22
  return `bg-login-50 h-0.5 absolute w-8 transition-all duration-[400ms] left-2 ${
@@ -30,6 +39,11 @@ export type NavbarProps = {
30
39
  className?: string
31
40
  innerClassName?: string
32
41
  children: React.ReactNode
42
+ bubble: {
43
+ lang?: BubbleContent
44
+ theme?: BubbleContent
45
+ login?: BubbleContent
46
+ }
33
47
  }
34
48
 
35
49
  export default function Navbar({
@@ -44,6 +58,7 @@ export default function Navbar({
44
58
  className,
45
59
  innerClassName,
46
60
  children,
61
+ bubble
47
62
  }: NavbarProps) {
48
63
  const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
49
64
 
@@ -74,11 +89,25 @@ export default function Navbar({
74
89
  {!disableThemeToggle &&
75
90
  <ThemeToggle />
76
91
  }
92
+ {bubble.theme?.condition && <Bubble
93
+ href={bubble.theme.href}
94
+ className={bubble.theme.className}
95
+ text={bubble.theme.text}
96
+ fill={bubble.theme.fill}
97
+ stroke={bubble.theme.stroke}
98
+ />}
77
99
  {!disableLanguageToggle &&
78
100
  <LanguageToggle
79
101
  language={lang}
80
102
  />
81
103
  }
104
+ {bubble.lang?.condition && <Bubble
105
+ href={bubble.lang.href}
106
+ className={bubble.lang.className}
107
+ text={bubble.lang.text}
108
+ fill={bubble.lang.fill}
109
+ stroke={bubble.lang.stroke}
110
+ />}
82
111
  {loginPath && logoutPath &&
83
112
  <AuthButton
84
113
  profilePath={profilePath}
@@ -87,6 +116,13 @@ export default function Navbar({
87
116
  logoutPath={logoutPath}
88
117
  />
89
118
  }
119
+ {bubble.login?.condition && <Bubble
120
+ href={bubble.login.href}
121
+ className={bubble.login.className}
122
+ text={bubble.login.text}
123
+ fill={bubble.login.fill}
124
+ stroke={bubble.login.stroke}
125
+ />}
90
126
  </nav>
91
127
 
92
128
  {/* Mobile Menu Button */}