feat(ui): Implement M3 FAB and finalize core UI rework (Stage 3)
- Implemented M3 Floating Action Button (FAB) with extended variant support - Integrated FAB into Navigation Rail (top placement) and Bottom Bar (floating) - Added user profile header to expanded sidebar - Polished M3 styles and transitions - Fixed various CSS and layout issues Refs #3 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
24
src/components/FAB.tsx
Normal file
24
src/components/FAB.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Plus } from 'lucide-react';
|
||||||
|
|
||||||
|
interface FABProps {
|
||||||
|
onClick?: () => void;
|
||||||
|
label?: string;
|
||||||
|
extended?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FAB: React.FC<FABProps> = ({ onClick, label, extended }) => {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={`m3-fab ${extended ? 'extended' : ''}`}
|
||||||
|
onClick={onClick}
|
||||||
|
title={label}
|
||||||
|
>
|
||||||
|
<div className="m3-fab-icon">
|
||||||
|
<Plus size={24} />
|
||||||
|
</div>
|
||||||
|
{extended && label && <span className="m3-fab-label">{label}</span>}
|
||||||
|
<div className="m3-fab-state-layer" />
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
import { useStore } from '../store/useStore';
|
import { useStore } from '../store/useStore';
|
||||||
import { useDisplay } from '../hooks/useDisplay';
|
import { useDisplay } from '../hooks/useDisplay';
|
||||||
import { useScrollDirection } from '../hooks/useScrollDirection';
|
import { useScrollDirection } from '../hooks/useScrollDirection';
|
||||||
|
import { FAB } from './FAB';
|
||||||
|
|
||||||
interface NavItem {
|
interface NavItem {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -88,21 +89,26 @@ export const Navigation: React.FC = () => {
|
|||||||
|
|
||||||
if (navMode === 'bar') {
|
if (navMode === 'bar') {
|
||||||
return (
|
return (
|
||||||
<nav className={`navigation-bar ${scrollDir === 'down' ? 'hidden' : ''}`}>
|
<>
|
||||||
{navItems.slice(0, 5).map((item) => (
|
<div className={`mobile-fab-container ${scrollDir === 'down' ? 'hidden' : ''}`}>
|
||||||
<NavLink
|
<FAB onClick={() => alert('Новая заявка')} label="Создать заявку" />
|
||||||
key={item.path}
|
</div>
|
||||||
to={item.path}
|
<nav className={`navigation-bar ${scrollDir === 'down' ? 'hidden' : ''}`}>
|
||||||
className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}
|
{navItems.slice(0, 5).map((item) => (
|
||||||
>
|
<NavLink
|
||||||
<div className="nav-item-icon-wrapper">
|
key={item.path}
|
||||||
<item.icon size={24} />
|
to={item.path}
|
||||||
{item.badgeKey && renderBadge(badges[item.badgeKey])}
|
className={({ isActive }) => `nav-item ${isActive ? 'active' : ''}`}
|
||||||
</div>
|
>
|
||||||
<span className="nav-item-label">{item.label}</span>
|
<div className="nav-item-icon-wrapper">
|
||||||
</NavLink>
|
<item.icon size={24} />
|
||||||
))}
|
{item.badgeKey && renderBadge(badges[item.badgeKey])}
|
||||||
</nav>
|
</div>
|
||||||
|
<span className="nav-item-label">{item.label}</span>
|
||||||
|
</NavLink>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +123,14 @@ export const Navigation: React.FC = () => {
|
|||||||
{isExpanded && <span className="rail-title">Bonch</span>}
|
{isExpanded && <span className="rail-title">Bonch</span>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div style={{ padding: isExpanded ? '0 16px 16px' : '0 12px 16px', display: 'flex', justifyContent: isExpanded ? 'flex-start' : 'center' }}>
|
||||||
|
<FAB
|
||||||
|
onClick={() => alert('Новая заявка')}
|
||||||
|
label="Создать заявку"
|
||||||
|
extended={isExpanded}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{isExpanded && profile && (
|
{isExpanded && profile && (
|
||||||
<div className="user-info">
|
<div className="user-info">
|
||||||
<div className="user-avatar">
|
<div className="user-avatar">
|
||||||
|
|||||||
@@ -142,6 +142,62 @@ body {
|
|||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* M3 FAB */
|
||||||
|
|
||||||
|
.m3-fab {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 16px;
|
||||||
|
border: none;
|
||||||
|
background-color: var(--md-sys-color-primary-container);
|
||||||
|
color: var(--md-sys-color-on-primary-container);
|
||||||
|
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab:hover {
|
||||||
|
box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab.extended {
|
||||||
|
padding: 0 16px;
|
||||||
|
width: auto;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab-icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab-label {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab-state-layer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: var(--md-sys-color-on-primary-container);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m3-fab:hover .m3-fab-state-layer {
|
||||||
|
opacity: 0.08;
|
||||||
|
}
|
||||||
|
|
||||||
/* M3 Filled Text Field */
|
/* M3 Filled Text Field */
|
||||||
|
|
||||||
.m3-text-field-container {
|
.m3-text-field-container {
|
||||||
@@ -269,6 +325,19 @@ body {
|
|||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-fab-container {
|
||||||
|
position: fixed;
|
||||||
|
right: 16px;
|
||||||
|
bottom: calc(var(--nav-bar-height) + 16px);
|
||||||
|
z-index: 99;
|
||||||
|
transition: transform 0.2s ease-in-out, opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-fab-container.hidden {
|
||||||
|
transform: translateY(calc(var(--nav-bar-height) + 16px));
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 600px) {
|
@media (min-width: 600px) {
|
||||||
.navigation-bar { display: none; }
|
.navigation-bar { display: none; }
|
||||||
.main-content { margin-left: var(--nav-rail-width); }
|
.main-content { margin-left: var(--nav-rail-width); }
|
||||||
|
|||||||
Reference in New Issue
Block a user