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

Set clickable area for skinny buttons and tabs #299

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
31920a3
Create draft PR for #288
IzzySmillie Dec 14, 2022
9f77085
Setup tab buttons for clickable area extension
IzzySmillie Dec 14, 2022
a2494a0
Update changelog
IzzySmillie Dec 14, 2022
f0e2783
Checkout tabs and colours from issues/274-Update_button_and_tab_activ…
IzzySmillie Dec 14, 2022
ab012e0
Update all tabs with class and css edits
IzzySmillie Dec 14, 2022
ee7190e
Update tests
IzzySmillie Dec 14, 2022
58420a9
Merge branch 'main' into issues/288-Set_clickable_area_for_skinny_but…
IzzySmillie Dec 21, 2022
c5c454a
Checkout button and app scss files from issues/274-Update_button_and_…
IzzySmillie Dec 21, 2022
43fa727
Updated tabs.scss from issues/274-Update_button_and_tab_active_or_ina…
IzzySmillie Dec 21, 2022
51108ff
Reverse tabs overwrite
IzzySmillie Dec 21, 2022
5d80c7e
Fix darkmode tab re-styling
IzzySmillie Dec 21, 2022
249555a
Small tab adjustments to match design more
IzzySmillie Dec 21, 2022
90482cf
Merge branch 'main' into issues/288-Set_clickable_area_for_skinny_but…
IzzySmillie Dec 21, 2022
be2c17b
Merge main
IzzySmillie Dec 21, 2022
07dfdea
Merge
IzzySmillie Dec 21, 2022
5a56e06
Update changelog after release
IzzySmillie Dec 21, 2022
76709c3
Merge branch 'main' into issues/288-Set_clickable_area_for_skinny_but…
IzzySmillie Dec 21, 2022
fd1ca3b
Fix focus-visible on tabs
IzzySmillie Dec 22, 2022
a699858
Merge branch 'main' into issues/288-Set_clickable_area_for_skinny_but…
IzzySmillie Dec 22, 2022
26e35d2
Use design vars for margin and paddings
IzzySmillie Dec 22, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Updated buttons and tabs styling (#296)
- Updated icons (#296)
- Bump engine.io from 6.2.0 to 6.2.1 (#272)
- Increased clickable area for tabs (#299)

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion src/components/Editor/Project/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const Project = (props) => {
<Tabs>
<TabList>
{ project.components.map((file, i) => (
<Tab key={i}>{file.name}.{file.extension}</Tab>
<Tab key={i}>
<span className='react-tabs__tab-inner'>{file.name}.{file.extension}</span>
</Tab>
)
)}
</TabList>
Expand Down
16 changes: 12 additions & 4 deletions src/components/Editor/Runners/PythonRunner/PythonRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ const PythonRunner = () => {
{hasVisualOutput ? <div className='output-panel output-panel--visual'>
<Tabs forceRenderTabPanel={true}>
<TabList>
<Tab key={0}>{t('output.visualOutput')}</Tab>
<Tab key={0}>
<span className='react-tabs__tab-inner'>{t('output.visualOutput')}</span>
</Tab>
{!isEmbedded ? <OutputViewToggle/> : null }
</TabList>
<TabPanel key={0} >
Expand All @@ -322,7 +324,9 @@ const PythonRunner = () => {
<div className='output-panel output-panel--text'>
<Tabs forceRenderTabPanel={true}>
<TabList>
<Tab key={0}>{t('output.textOutput')}</Tab>
<Tab key={0}>
<span className='react-tabs__tab-inner'>{t('output.textOutput')}</span>
</Tab>
{ hasVisualOutput || isEmbedded ? null : <OutputViewToggle /> }
</TabList>
<ErrorMessage />
Expand All @@ -336,9 +340,13 @@ const PythonRunner = () => {
<Tabs forceRenderTabPanel={true} defaultIndex={hasVisualOutput ? 0 : 1}>
<TabList>
{hasVisualOutput ?
<Tab key={0}>{t('output.visualOutput')}</Tab> : null
<Tab key={0}>
<span className='react-tabs__tab-inner'>{t('output.visualOutput')}</span>
</Tab> : null
}
<Tab key={1}>{t('output.textOutput')}</Tab>
<Tab key={1}>
<span className='react-tabs__tab-inner'>{t('output.textOutput')}</span>
</Tab>
{!isEmbedded ? <OutputViewToggle/> : null }
</TabList>
<ErrorMessage />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ test('Tabbed view has text and visual tabs with same parent element', () => {
}
const store = mockStore(initialState);
render(<Provider store={store}><PythonRunner /></Provider>)
expect(screen.getByText('output.visualOutput').parentElement).toEqual(screen.getByText('output.textOutput').parentElement)
expect(screen.getByText('output.visualOutput').parentElement.parentElement).toEqual(screen.getByText('output.textOutput').parentElement.parentElement)
})

test('Split view has text and visual tabs with different parent elements', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ exports[`Renders without crashing 1`] = `
role="tab"
tabindex="0"
>
output.textOutput
<span
class="react-tabs__tab-inner"
>
output.textOutput
</span>
</li>
<div
class="output-view-toggle"
Expand Down
72 changes: 61 additions & 11 deletions src/tabs.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
@import './colours.scss';
@import './components/Button/Button.scss';

$spacing-eight: calc(var(--spacing-1) / 1.25);
$spacing-four: calc($spacing-eight / 2);

#app, #wc {
.react-tabs {
flex: 1;
display: flex;
flex-flow: column;
overflow: hidden;
position: relative;
&__tab {

&__tab-inner {
@extend .btn;
@extend .btn--secondary;

border: 3px solid transparent;
margin: $spacing-eight $spacing-four;
padding: $spacing-four var(--spacing-1);
}

&__tab {
border: none;
background-color: transparent;
padding: 0;
margin: 0;

&--selected {
border: 3px solid $rpf-teal-shade-20;
border-radius: 0;

.react-tabs__tab-inner {
border: 3px solid $rpf-teal-shade-20;
}
}

&:hover {
.react-tabs__tab-inner {
background-color: $rpi-grey-40;
}
}

&:focus {
Expand All @@ -23,11 +47,27 @@

&:focus-visible {
outline: none;

.react-tabs__tab-inner {
border: 3px solid $rpf-brand-raspberry;
}
}

&:focus:after {
display: none;
}
}

&:first-of-type {
.react-tabs__tab-inner {
margin-left: $spacing-eight;
}
}

&:last-of-type {
.react-tabs__tab-inner {
margin-right: $spacing-eight;
}
}
}

&__tab-list {
Expand All @@ -51,7 +91,9 @@

&__tab {
&--selected {
background-color: $rpi-grey-5;
.react-tabs__tab-inner {
background-color: $rpi-grey-5;
}
}
}
}
Expand All @@ -66,18 +108,26 @@
}

&__tab {
background-color: $rpf-darkmode-grey32;
color: $rpf-white;

&:hover {
background-color: $rpf-darkmode-grey22;
.react-tabs__tab-inner {
background-color: $rpf-darkmode-grey22;
}
}

&--selected {
color: inherit;
background-color: $rpf-darkmode-grey42;
color: $rpf-white;

.react-tabs__tab-inner {
color: inherit;
background-color: $rpf-darkmode-grey42;
}
}
}

&__tab-inner {
background-color: $rpf-darkmode-grey32;
color: $rpf-white;
}
}
}
}