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

Protection level rework #34

Merged
merged 1 commit into from Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions Extension/src/pages/common/components/ThinCard/ThinCard.jsx
@@ -0,0 +1,8 @@
import { Card } from '@qwant/qwant-ponents';
import cx from 'classnames';
import React from 'react';
import Styles from './ThinCard.module.scss';

export function ThinCard({ className, ...props }) {
return <Card {...props} className={cx(Styles.ThinCard, className)} />;
}
@@ -0,0 +1,3 @@
.ThinCard {
border: 1px solid var(--grey-200) !important;
}
2 changes: 1 addition & 1 deletion Extension/src/pages/popup/components/MainView/MainView.jsx
Expand Up @@ -10,7 +10,7 @@ import { Stack } from '@qwant/qwant-ponents';
import { LoadingView } from './LoadingView';
import { GlobalStats } from './GlobalStats';
import { PermissionsMissing } from './PermissionsMissing';
import { ProtectionLevel } from './ProtectionLevel';
import { ProtectionLevel } from './ProtectionLevel/ProtectionLevel';
import { ProtectionStatus } from './ProtectionStatus/ProtectionStatus';

import { messenger } from '../../../services/messenger';
Expand Down
@@ -0,0 +1,43 @@
import React from 'react';
import { t } from '~src/common/translators/reactTranslator';

import { ThinCard } from '~src/pages/common/components/ThinCard/ThinCard';
import { Flex, IconArrowRightSLine, Text } from '@qwant/qwant-ponents';
import Styles from './ProtectionLevel.module.scss';

const getProtectionLevel = ({
protectionLevel,
applicationFilteringDisabled,
}) => {
if (applicationFilteringDisabled) return 'disabled';
return protectionLevel;
};

export const ProtectionLevel = ({
protectionLevel,
applicationFilteringDisabled,
onClick,
}) => {
const level = getProtectionLevel({
protectionLevel,
applicationFilteringDisabled,
});

return (
<ThinCard p="s" onClick={onClick} as="button" className={Styles.ProtectionLevel}>
<Flex between alignCenter>
<Text bold typo="body-2" color="primary">
{t('protection_level')}
</Text>
<Text typo="heading-5" color="primary">
<Flex alignCenter>
<Text typo="body-2" color="primary">
{level ? t(`protection_level_${level}`) : ''}
</Text>
<IconArrowRightSLine />
</Flex>
</Text>
</Flex>
</ThinCard>
);
};
@@ -0,0 +1,7 @@
.ProtectionLevel svg {
transition: transform .3s;
}

.ProtectionLevel:hover svg {
transform: translateX(var(--spacing-xxs));
}

This file was deleted.

This file was deleted.