From 87cea98d522e1d0446b14505c340a1d65b0a6f14 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 14 Oct 2023 01:52:53 +0300 Subject: [PATCH] feat: swap panel component (#51687) Co-authored-by: Oliver Eyton-Williams --- .../client-only-routes/show-unsubscribed.tsx | 6 +- client/src/client-only-routes/show-user.tsx | 9 +-- .../SolutionViewer/solution-viewer.tsx | 7 +- client/src/components/layouts/global.css | 19 ----- .../__snapshots__/honesty.test.tsx.snap | 8 +- .../src/components/settings/danger-zone.css | 12 --- .../src/components/settings/danger-zone.tsx | 5 +- client/src/components/settings/honesty.tsx | 3 +- client/src/components/settings/user-token.css | 15 ---- client/src/components/settings/user-token.tsx | 6 +- tools/ui-components/src/index.ts | 1 + .../ui-components/src/panel/panel.stories.tsx | 10 +-- tools/ui-components/src/panel/panel.test.tsx | 4 +- tools/ui-components/src/panel/panel.tsx | 80 +++++++++---------- tools/ui-components/src/panel/types.ts | 2 +- 15 files changed, 68 insertions(+), 119 deletions(-) diff --git a/client/src/client-only-routes/show-unsubscribed.tsx b/client/src/client-only-routes/show-unsubscribed.tsx index 14738448859..d578a13bc1d 100644 --- a/client/src/client-only-routes/show-unsubscribed.tsx +++ b/client/src/client-only-routes/show-unsubscribed.tsx @@ -1,10 +1,10 @@ -import { Panel, Button } from '@freecodecamp/react-bootstrap'; +import { Button } from '@freecodecamp/react-bootstrap'; import type { RouteComponentProps } from '@reach/router'; import React from 'react'; import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; +import { Container, Panel } from '@freecodecamp/ui'; -import { Container } from '@freecodecamp/ui'; import envData from '../../config/env.json'; import { Spacer } from '../components/helpers'; import FullWidthRow from '../components/helpers/full-width-row'; @@ -28,7 +28,7 @@ function ShowUnsubscribed({
- +

{t('misc.unsubscribed')} diff --git a/client/src/client-only-routes/show-user.tsx b/client/src/client-only-routes/show-user.tsx index f783731d258..6a67c2fb163 100644 --- a/client/src/client-only-routes/show-user.tsx +++ b/client/src/client-only-routes/show-user.tsx @@ -1,5 +1,4 @@ import { - Panel, FormControl, FormGroup, ControlLabel, @@ -11,7 +10,7 @@ import type { TFunction } from 'i18next'; import { Trans, withTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import { Col, Row } from '@freecodecamp/ui'; +import { Col, Row, Panel } from '@freecodecamp/ui'; import Login from '../components/Header/components/login'; @@ -84,11 +83,9 @@ function ShowUser({
- + - - {t('report.sign-in')} - + {t('report.sign-in')} diff --git a/client/src/components/SolutionViewer/solution-viewer.tsx b/client/src/components/SolutionViewer/solution-viewer.tsx index 841146b438b..d839423d378 100644 --- a/client/src/components/SolutionViewer/solution-viewer.tsx +++ b/client/src/components/SolutionViewer/solution-viewer.tsx @@ -1,7 +1,8 @@ -import { Panel } from '@freecodecamp/react-bootstrap'; import Prism from 'prismjs'; import React from 'react'; -import { ChallengeFile } from '../../redux/prop-types'; +import { Panel } from '@freecodecamp/ui'; + +import type { ChallengeFile } from '../../redux/prop-types'; type Props = { challengeFiles: Solution[] | null; @@ -25,7 +26,7 @@ function SolutionViewer({ challengeFiles, solution }: Props): JSX.Element { return ( <> {solutions.map(({ fileKey, ext, contents }) => ( - + {ext.toUpperCase()}
diff --git a/client/src/components/layouts/global.css b/client/src/components/layouts/global.css
index 9c7eb70a415..2b2e431e812 100644
--- a/client/src/components/layouts/global.css
+++ b/client/src/components/layouts/global.css
@@ -470,11 +470,6 @@ code {
   white-space: break-spaces;
 }
 
-.panel {
-  border-radius: 0;
-  background-color: transparent;
-}
-
 .help-block em {
   font-size: 0.8rem;
 }
@@ -519,10 +514,6 @@ hr {
   color: var(--quaternary-color);
 }
 
-.panel-default > .panel-heading {
-  background-color: transparent;
-}
-
 .challenge-output span {
   font-size: 1rem;
 }
@@ -544,12 +535,6 @@ pre {
   border-radius: 0;
 }
 
-.panel-primary > .panel-heading {
-  background-color: transparent;
-  border-color: var(--primary-color);
-  color: var(--primary-color);
-}
-
 .solution-viewer,
 .solution-viewer pre {
   margin-bottom: 0;
@@ -593,10 +578,6 @@ pre {
   border-color: var(--tertiary-color);
 }
 
-.panel-primary {
-  border-color: var(--primary-color);
-}
-
 blockquote footer,
 blockquote small,
 blockquote .small {
diff --git a/client/src/components/settings/__snapshots__/honesty.test.tsx.snap b/client/src/components/settings/__snapshots__/honesty.test.tsx.snap
index 64fb93f8770..b2ad2db22d0 100644
--- a/client/src/components/settings/__snapshots__/honesty.test.tsx.snap
+++ b/client/src/components/settings/__snapshots__/honesty.test.tsx.snap
@@ -8,7 +8,7 @@ exports[`  snapshot when isHonest is false: Honesty 1`] =
     settings.headings.honesty
   
   
-    
       

@@ -42,7 +42,7 @@ exports[` snapshot when isHonest is false: Honesty 1`] =

-
+