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

discoverfinancial/a11y-theme-builder#356: separated the Hero organism… #359

Merged
merged 1 commit into from
May 4, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions code/src/ui/src/pages/components/HeroComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Discover Financial Services
* Licensed under MIT License. See License.txt in the project root for license information
*/
import React, { useEffect, useState } from 'react';
import { InputLabel, RadioGroup, FormControlLabel, Radio } from '@mui/material';
import { DesignSystem, Hero } from 'a11y-theme-builder-sdk';
import { HeroExample } from '../../pages/organisms/HeroExample';
import { GeneratedCodeSection } from '../content/GeneratedCodeSection';
import { ExampleSection } from '../content/ExampleSection';
import { SettingsSection } from '../content/SettingsSection';
import { HeadingSection } from '../content/HeadingSection';
import { ColorModeSelector } from '../content/ColorModeSelector';
import { HeroColorModeSelector } from '../content/HeroColorModeSelector';
interface Props {
}

export const HeroComponent: React.FC<Props> = ({ }) => {

const [colorMode, setColorMode] = useState<string>("default");

return (
<div>
<HeadingSection title="Desktop" heading="Hero" />
<ExampleSection>
<HeroColorModeSelector colorMode={colorMode} setColorMode={setColorMode}>
<HeroExample colorMode={colorMode}/>
</HeroColorModeSelector>
</ExampleSection>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { ChipsComponent } from '../../components/ChipsComponent';
import { DropdownComponent } from '../../components/DropdownComponent';
import { SlidersComponent } from '../../components/SlidersComponent';
import { DividerComponent } from '../../components/DividerComponent';
import { HeroComponent } from '../../components/HeroComponent';

interface Props {
user: any;
Expand Down Expand Up @@ -185,6 +186,7 @@ export const ComponentsContent: React.FC<Props> = ({ user, designSystem }) => {
<LeftNavItem text={"Divider"} value="divider" indent={1} selected={showComponent} onClick={()=> {setShowComponent("divider")}} disabled={disabled}/>

<LeftNavItem text={"Dropdown"} value="dropdown" indent={1} selected={showComponent} onClick={()=> {setShowComponent("dropdown")}} disabled={disabled}/>
<LeftNavItem text={"Hero"} value="hero" indent={1} selected={showComponent} onClick={()=> {setShowComponent("hero")}} disabled={disabled}/>
<LeftNavItem text={"Images"} value="imageDecorations" indent={1} selected={showComponent} onClick={()=> {setShowComponent("imageDecorations")}} disabled={disabled}/>

<LeftNavItem text={"Menus"} value="menus" indent={1} selected={showComponent} onClick={()=> {setShowComponent("menus")}} disabled={disabled}/>
Expand Down Expand Up @@ -357,6 +359,9 @@ export const ComponentsContent: React.FC<Props> = ({ user, designSystem }) => {
{showComponent === "tooltips" &&
<TooltipsComponent />
}
{showComponent === "hero" &&
<HeroComponent />
}
</div>
</div>
</>
Expand Down
37 changes: 16 additions & 21 deletions code/src/ui/src/pages/organisms/HeroExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,24 @@ import { Hero } from "../../mui-a11y-tb/components/Hero";
import { ExampleSection } from '../content/ExampleSection';

interface Props {
style?: any;
colorMode?: string;
}

export const HeroExample: React.FC<Props> = ({style}) => {
const [colorMode, setColorMode] = useState<string>("default");
export const HeroExample: React.FC<Props> = ({colorMode=""}) => {
return (
<ExampleSection>
<HeroColorModeSelector colorMode={colorMode} setColorMode={setColorMode}>
<Hero className={colorMode} >
<Breadcrumbs aria-label="breadcrumb" className="breadcrumbs">
<Link>Home</Link>
<Link>Page</Link>
<Typography>Page</Typography>
</Breadcrumbs>
<div className="title">Page Title</div>
<div className="body">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.
</p>
</div>
<Button>Get Started</Button>
</Hero>
</HeroColorModeSelector>
</ExampleSection>
<Hero className={colorMode} >
<Breadcrumbs aria-label="breadcrumb" className="breadcrumbs">
<Link>Home</Link>
<Link>Page</Link>
<Typography>Page</Typography>
</Breadcrumbs>
<div className="title">Page Title</div>
<div className="body">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.
</p>
</div>
<Button>Get Started</Button>
</Hero>
)
}
7 changes: 3 additions & 4 deletions code/src/ui/src/pages/organisms/HeroOrganism.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export const HeroOrganism: React.FC<Props> = ({ organism, designSystem }) => {
<p>Configure settings that affect the appearance of Hero organisms. Heros are a common content-pattern that is located in a prominant location and may contain introductory text for a website and may contain breadcrumbs, buttons and other components.</p>
</HeadingSection>


<HeroExample/>


<ExampleSection>
<HeroExample/>
</ExampleSection>

<SettingsSection>
<div className="top40">
Expand Down
Loading