Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: A new toggle button for advanced settings #5290

Merged
merged 10 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
flex-direction: column;
}
}

.advancedSettings {
cursor: pointer;
border-radius: 4px;
}
ch0rizo marked this conversation as resolved.
Show resolved Hide resolved
30 changes: 26 additions & 4 deletions app/routes/users/components/UserSettings/UserSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Flex, Icon, LoadingIndicator } from '@webkom/lego-bricks';
import {
Accordion,
Button,
Flex,
Icon,
LoadingIndicator,
} from '@webkom/lego-bricks';
import { usePreparedEffect } from '@webkom/react-prepare';
import { Github, Linkedin, Mail } from 'lucide-react';
import { ChevronRight, Github, Linkedin, Mail } from 'lucide-react';
import { Field } from 'react-final-form';
import { useNavigate, useParams } from 'react-router-dom';
import { fetchUser, updateUser } from 'app/actions/UserActions';
Expand Down Expand Up @@ -39,6 +45,7 @@ import ChangePassword from './ChangePassword';
import UserImage from './UserImage';
import styles from './UserSettings.module.css';
import type { CurrentUser } from 'app/store/models/User';
import { divide } from 'lodash';

type GenderKey = keyof typeof Gender;

Expand Down Expand Up @@ -243,7 +250,22 @@ const UserSettings = () => {
</TypedLegoForm>

{isCurrentUser && (
<>
ch0rizo marked this conversation as resolved.
Show resolved Hide resolved
<Accordion
triggerComponent={({ onClick, disabled, rotateClassName }) => (
<div className={ styles.advancedSettings } onClick={onClick}>
<Flex gap={5} alignItems="center">
<h2>Avansert</h2>
ch0rizo marked this conversation as resolved.
Show resolved Hide resolved
{!disabled && (
<Icon
onPress={onClick}
iconNode={<ChevronRight />}
className={rotateClassName}
/>
)}
</Flex>
</div>
)}
>
<div>
<h2>Endre passord</h2>
<ChangePassword />
Expand All @@ -252,7 +274,7 @@ const UserSettings = () => {
<h2 className={styles.deleteUser}>Slett bruker</h2>
<DeleteUser />
</div>
</>
</Accordion>
)}
</ContentMain>
);
Expand Down
Loading