diff --git a/airbyte-webapp/src/components/DocumentationPanel/DocumentationPanel.tsx b/airbyte-webapp/src/components/DocumentationPanel/DocumentationPanel.tsx index 9723c03ca0a3..4e146026f910 100644 --- a/airbyte-webapp/src/components/DocumentationPanel/DocumentationPanel.tsx +++ b/airbyte-webapp/src/components/DocumentationPanel/DocumentationPanel.tsx @@ -8,8 +8,9 @@ import { useUpdateEffect } from "react-use"; import rehypeSlug from "rehype-slug"; import urls from "rehype-urls"; -import { LoadingPage, PageTitle } from "components"; +import { LoadingPage } from "components"; import { Markdown } from "components/ui/Markdown"; +import { PageHeader } from "components/ui/PageHeader"; import { useConfig } from "config"; import { useDocumentation } from "hooks/services/useDocumentation"; @@ -52,7 +53,7 @@ export const DocumentationPanel: React.FC = () => { ) : (
- } /> + } /> ` - padding: 20px 32px 18px; - border-bottom: ${({ theme, withLine }) => (withLine ? `1px solid ${theme.greyColor20}` : "none")}; - position: relative; - z-index: 2; - color: ${({ theme }) => theme.darkPrimaryColor}; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; -`; - -export const MiddleBlock = styled.div` - flex: 1 0 0; - display: flex; - justify-content: center; -`; - -export const MiddleTitleBlock = styled(H3)` - flex: 1 0 0; - display: flex; - justify-content: center; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -`; - -export const EndBlock = styled.div` - flex: 1 0 0; - display: flex; - justify-content: flex-end; -`; - -export const TitleBlock = styled(H3)` - flex: 1 0 0; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -`; - -const PageTitle: React.FC = ({ title, withLine, middleComponent, middleTitleBlock, endComponent }) => ( - - {title} - {middleTitleBlock ? ( - {middleTitleBlock} - ) : ( - {middleComponent} - )} - {endComponent} - -); - -export default PageTitle; diff --git a/airbyte-webapp/src/components/PageTitle/index.tsx b/airbyte-webapp/src/components/PageTitle/index.tsx deleted file mode 100644 index 9557b396dbbf..000000000000 --- a/airbyte-webapp/src/components/PageTitle/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import PageTitle from "./PageTitle"; - -export default PageTitle; -export { PageTitle }; diff --git a/airbyte-webapp/src/components/index.tsx b/airbyte-webapp/src/components/index.tsx index 0c0ec0b3b2d9..550e525f17da 100644 --- a/airbyte-webapp/src/components/index.tsx +++ b/airbyte-webapp/src/components/index.tsx @@ -10,7 +10,6 @@ export * from "./LabeledSwitch"; export * from "./Link"; export * from "./LoadingPage"; export * from "./MainPageWithScroll"; -export * from "./PageTitle"; export * from "./SimpleTableComponents"; export * from "./StatusIcon"; export * from "./ConnectorCard"; diff --git a/airbyte-webapp/src/components/PageTitle/PageTitle.module.scss b/airbyte-webapp/src/components/ui/PageHeader/PageHeader.module.scss similarity index 90% rename from airbyte-webapp/src/components/PageTitle/PageTitle.module.scss rename to airbyte-webapp/src/components/ui/PageHeader/PageHeader.module.scss index 0d1f1fba56a1..6ad22a10a7f3 100644 --- a/airbyte-webapp/src/components/PageTitle/PageTitle.module.scss +++ b/airbyte-webapp/src/components/ui/PageHeader/PageHeader.module.scss @@ -1,5 +1,5 @@ -@use "../../scss/colors"; -@use "../../scss/variables"; +@use "../../../scss/colors"; +@use "../../../scss/variables"; .container { padding: variables.$spacing-xl 32px 0; diff --git a/airbyte-webapp/src/components/ui/PageHeader/PageHeader.tsx b/airbyte-webapp/src/components/ui/PageHeader/PageHeader.tsx new file mode 100644 index 000000000000..91acb27afb4c --- /dev/null +++ b/airbyte-webapp/src/components/ui/PageHeader/PageHeader.tsx @@ -0,0 +1,48 @@ +import classNames from "classnames"; +import React from "react"; + +import { Text } from "components/ui/Text"; + +import styles from "./PageHeader.module.scss"; + +interface PageHeaderProps { + withLine?: boolean; + middleComponent?: React.ReactNode; + middleTitleBlock?: React.ReactNode; + endComponent?: React.ReactNode; + title: React.ReactNode; +} + +export const PageHeader: React.FC = ({ + title, + withLine, + middleComponent, + middleTitleBlock, + endComponent, +}) => ( +
+ + {title} + + {middleTitleBlock ? ( + + {middleTitleBlock} + + ) : ( +
{middleComponent}
+ )} +
{endComponent}
+
+); diff --git a/airbyte-webapp/src/components/ui/PageHeader/index.stories.tsx b/airbyte-webapp/src/components/ui/PageHeader/index.stories.tsx new file mode 100644 index 000000000000..dfd9bfdac3b7 --- /dev/null +++ b/airbyte-webapp/src/components/ui/PageHeader/index.stories.tsx @@ -0,0 +1,28 @@ +import { faPlus } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { ComponentStory, ComponentMeta } from "@storybook/react"; + +import { Button } from "../Button"; +import { PageHeader } from "./PageHeader"; + +export default { + title: "UI/PageHeader", + component: PageHeader, + argTypes: {}, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ; + +const title = "Connections"; + +const endComponent = ( + +); + +export const Primary = Template.bind({}); +Primary.args = { + title, + endComponent, +}; diff --git a/airbyte-webapp/src/components/ui/PageHeader/index.tsx b/airbyte-webapp/src/components/ui/PageHeader/index.tsx new file mode 100644 index 000000000000..78b169af8a23 --- /dev/null +++ b/airbyte-webapp/src/components/ui/PageHeader/index.tsx @@ -0,0 +1 @@ +export * from "./PageHeader"; diff --git a/airbyte-webapp/src/packages/cloud/views/credits/CreditsPage/CreditsPage.tsx b/airbyte-webapp/src/packages/cloud/views/credits/CreditsPage/CreditsPage.tsx index 00bcf92a30d4..7d485ce749cb 100644 --- a/airbyte-webapp/src/packages/cloud/views/credits/CreditsPage/CreditsPage.tsx +++ b/airbyte-webapp/src/packages/cloud/views/credits/CreditsPage/CreditsPage.tsx @@ -2,9 +2,9 @@ import React from "react"; import { FormattedMessage } from "react-intl"; import styled from "styled-components"; -import { PageTitle } from "components"; import HeadTitle from "components/HeadTitle"; import MainPageWithScroll from "components/MainPageWithScroll"; +import { PageHeader } from "components/ui/PageHeader"; import { PageTrackingCodes, useTrackPage } from "hooks/services/Analytics"; import { useAuthService } from "packages/cloud/services/auth/AuthService"; @@ -28,7 +28,7 @@ const CreditsPage: React.FC = () => { return ( } - pageTitle={} />} + pageTitle={} />} > {!emailVerified && } diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/AllConnectionsPage/AllConnectionsPage.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/AllConnectionsPage/AllConnectionsPage.tsx index 9e9cd835dca7..d444bc23f336 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/AllConnectionsPage/AllConnectionsPage.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/AllConnectionsPage/AllConnectionsPage.tsx @@ -4,9 +4,10 @@ import React, { Suspense } from "react"; import { FormattedMessage } from "react-intl"; import { useNavigate } from "react-router-dom"; -import { Button, LoadingPage, MainPageWithScroll, PageTitle } from "components"; +import { Button, LoadingPage, MainPageWithScroll } from "components"; import { EmptyResourceListView } from "components/EmptyResourceListView"; import HeadTitle from "components/HeadTitle"; +import { PageHeader } from "components/ui/PageHeader"; import { useTrackPage, PageTrackingCodes } from "hooks/services/Analytics"; import { useConnectionList } from "hooks/services/useConnectionHook"; @@ -28,7 +29,7 @@ const AllConnectionsPage: React.FC = () => { } pageTitle={ - } endComponent={
@@ -93,7 +93,7 @@ exports[` should renders with mock data without cr class="container" >
Alpha
@@ -125,7 +125,7 @@ exports[` should renders with mock data without cr > @@ -188,7 +188,7 @@ exports[` should renders with mock data without cr > @@ -230,7 +230,7 @@ exports[` should renders with mock data without cr > @@ -272,7 +272,7 @@ exports[` should renders with mock data without cr > @@ -291,7 +291,7 @@ exports[` should renders with mock data without cr class="container" >
Alpha
diff --git a/airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap b/airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap index cc148aa5d9b9..e4704e8a81c5 100644 --- a/airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap +++ b/airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap @@ -22,7 +22,7 @@ exports[` should renders without crash with provided pr > @@ -41,7 +41,7 @@ exports[` should renders without crash with provided pr class="container" >
Alpha