@skroz/frontend 0.0.7 → 0.0.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.
@@ -6,13 +6,17 @@ interface AuthButtonsProps {
6
6
  showLogin: boolean;
7
7
  loginTitle?: React.ReactNode;
8
8
  loginIcon?: React.ReactNode;
9
+ loginClassName?: string;
9
10
  registerTitle?: React.ReactNode;
10
11
  loginButtonType: ButtonType;
12
+ registerButtonType?: ButtonType;
11
13
  showRegister: boolean;
12
14
  fantastic?: boolean;
13
- registerClassname?: string;
15
+ registerClassName?: string;
14
16
  registerBlock?: boolean;
15
17
  buttonSize?: SizeType;
18
+ className?: string;
19
+ reversed?: boolean;
16
20
  }
17
21
  declare const AuthButtons: React.FC<AuthButtonsProps>;
18
22
  export default AuthButtons;
@@ -5,25 +5,25 @@ import { useTranslation } from 'next-i18next';
5
5
  import Link from 'next/link';
6
6
  import AuthModal from './AuthModal';
7
7
  import { useFrontendConfig } from '../utils/FrontendContext';
8
- const AuthButtons = ({ modal, loginButtonType, showLogin, loginIcon, showRegister, fantastic, loginTitle, registerTitle, registerClassname = '', buttonSize = 'middle', registerBlock, }) => {
8
+ const AuthButtons = ({ modal, loginButtonType, registerButtonType = 'primary', showLogin, loginIcon, loginClassName, showRegister, fantastic, loginTitle, registerTitle, registerClassName = '', buttonSize = 'middle', registerBlock, className = '', reversed = false, }) => {
9
9
  const { t } = useTranslation('common');
10
10
  const config = useFrontendConfig();
11
11
  const [visible, setVisible] = useState(false);
12
12
  const [authType, setAuthType] = useState('login');
13
- const loginButton = (_jsx("div", { className: "auth-buttons-item", children: _jsx(Button, { type: loginButtonType, shape: loginTitle !== false ? 'round' : 'circle', size: buttonSize, icon: loginIcon, onClick: modal
13
+ const loginButton = (_jsx("div", { className: `auth-buttons-item ${loginClassName || ''}`, children: _jsx(Button, { type: loginButtonType, shape: loginTitle !== false ? 'round' : 'circle', size: buttonSize, icon: loginIcon, onClick: modal
14
14
  ? () => {
15
15
  setVisible(true);
16
16
  setAuthType('login');
17
17
  }
18
18
  : undefined, children: loginTitle !== false ? loginTitle || t('buttons.login') : '' }) }));
19
19
  const loginButtonContainer = modal ? (loginButton) : (_jsx(Link, { href: config.loginPath || '/login', passHref: true, legacyBehavior: true, children: loginButton }));
20
- const registerButton = (_jsx("div", { className: "auth-buttons-item", children: _jsx(Button, { shape: "round", className: registerClassname, size: buttonSize, type: "primary", block: registerBlock, onClick: modal
20
+ const registerButton = (_jsx("div", { className: "auth-buttons-item", children: _jsx(Button, { shape: "round", className: registerClassName, size: buttonSize, type: registerButtonType, block: registerBlock, onClick: modal
21
21
  ? () => {
22
22
  setVisible(true);
23
23
  setAuthType('register');
24
24
  }
25
25
  : undefined, children: registerTitle || t('buttons.register') }) }));
26
26
  const registerButtonContainer = modal ? (registerButton) : (_jsx(Link, { href: config.registerPath || '/register', passHref: true, legacyBehavior: true, children: registerButton }));
27
- return (_jsxs("div", { className: `auth-buttons ${fantastic ? 'fantastic' : ''}`, children: [showLogin && loginButtonContainer, showRegister && registerButtonContainer, modal && (_jsx(AuthModal, { authType: authType, visible: visible, onClose: () => setVisible(false), setAuthType: setAuthType }))] }));
27
+ return (_jsxs("div", { className: `auth-buttons ${fantastic ? 'fantastic' : ''} ${reversed ? 'is-reversed' : ''} ${className}`, children: [showLogin && loginButtonContainer, showRegister && registerButtonContainer, modal && (_jsx(AuthModal, { authType: authType, visible: visible, onClose: () => setVisible(false), setAuthType: setAuthType }))] }));
28
28
  };
29
29
  export default AuthButtons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skroz/frontend",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "f2cd3aab624bb4b31ac099f978526c14689a34a9"
49
+ "gitHead": "e7ce7163def41ef1fee71f0d0a1bec12661e100a"
50
50
  }
@@ -12,27 +12,35 @@ interface AuthButtonsProps {
12
12
  showLogin: boolean;
13
13
  loginTitle?: React.ReactNode;
14
14
  loginIcon?: React.ReactNode;
15
+ loginClassName?: string;
15
16
  registerTitle?: React.ReactNode;
16
17
  loginButtonType: ButtonType;
18
+ registerButtonType?: ButtonType;
17
19
  showRegister: boolean;
18
20
  fantastic?: boolean;
19
- registerClassname?: string;
21
+ registerClassName?: string;
20
22
  registerBlock?: boolean;
21
23
  buttonSize?: SizeType;
24
+ className?: string;
25
+ reversed?: boolean;
22
26
  }
23
27
 
24
28
  const AuthButtons: React.FC<AuthButtonsProps> = ({
25
29
  modal,
26
30
  loginButtonType,
31
+ registerButtonType = 'primary',
27
32
  showLogin,
28
33
  loginIcon,
34
+ loginClassName,
29
35
  showRegister,
30
36
  fantastic,
31
37
  loginTitle,
32
38
  registerTitle,
33
- registerClassname = '',
39
+ registerClassName = '',
34
40
  buttonSize = 'middle',
35
41
  registerBlock,
42
+ className = '',
43
+ reversed = false,
36
44
  }) => {
37
45
  const { t } = useTranslation('common');
38
46
  const config = useFrontendConfig();
@@ -42,7 +50,7 @@ const AuthButtons: React.FC<AuthButtonsProps> = ({
42
50
  );
43
51
 
44
52
  const loginButton = (
45
- <div className="auth-buttons-item">
53
+ <div className={`auth-buttons-item ${loginClassName || ''}`}>
46
54
  <Button
47
55
  type={loginButtonType}
48
56
  shape={loginTitle !== false ? 'round' : 'circle'}
@@ -74,9 +82,9 @@ const AuthButtons: React.FC<AuthButtonsProps> = ({
74
82
  <div className="auth-buttons-item">
75
83
  <Button
76
84
  shape="round"
77
- className={registerClassname}
85
+ className={registerClassName}
78
86
  size={buttonSize}
79
- type="primary"
87
+ type={registerButtonType}
80
88
  block={registerBlock}
81
89
  onClick={
82
90
  modal
@@ -101,7 +109,7 @@ const AuthButtons: React.FC<AuthButtonsProps> = ({
101
109
  );
102
110
 
103
111
  return (
104
- <div className={`auth-buttons ${fantastic ? 'fantastic' : ''}`}>
112
+ <div className={`auth-buttons ${fantastic ? 'fantastic' : ''} ${reversed ? 'is-reversed' : ''} ${className}`}>
105
113
  {showLogin && loginButtonContainer}
106
114
  {showRegister && registerButtonContainer}
107
115
  {modal && (
@@ -123,16 +123,31 @@
123
123
 
124
124
  .auth-buttons {
125
125
  text-align: center;
126
+ display: inline-flex;
127
+ flex-wrap: wrap;
128
+ gap: @page-xxs-padding;
129
+
130
+ &.is-reversed {
131
+ flex-direction: row-reverse;
132
+ }
126
133
 
127
134
  &-item {
128
- display: inline-flex;
129
- gap: @page-xxs-padding;
130
- //margin-right: @page-xxs-padding;
131
- //margin-bottom: @page-xxs-padding;
135
+ display: inline-block;
136
+ }
137
+ }
132
138
 
133
- &:last-child {
134
- margin-right: 0;
135
- }
139
+ .contrast-button {
140
+ background: linear-gradient(45deg, @contrast-gradient-color, @contrast-gradient-color, @contrast-color);
141
+ border: 0;
142
+ color: @white-text-color;
143
+
144
+ &:hover,
145
+ &:not(:disabled):not(.ant-btn-disabled):hover,
146
+ &:not(:disabled):not(.ant-btn-disabled):active,
147
+ &:focus {
148
+ background: linear-gradient(45deg, @contrast-gradient-color, @contrast-gradient-color, @contrast-color);
149
+ color: @white-text-color;
150
+ opacity: 0.8;
136
151
  }
137
152
  }
138
153