Skip to content

Commit

Permalink
Merge pull request #2102 from tf/text-inline-rights-tweaks
Browse files Browse the repository at this point in the history
Improve text inline file rights
  • Loading branch information
tf authored Apr 26, 2024
2 parents b1f0519 + 4bc538e commit 7e6605e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 24 deletions.
44 changes: 22 additions & 22 deletions entry_types/scrolled/package/src/frontend/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@ const Section = withInlineEditingDecorator('SectionDecorator', function Section(
<SectionLifecycleProvider onActivate={onActivate}
entersWithFadeTransition={section.transition?.startsWith('fade')}>
<SectionViewTimelineProvider backdrop={backdrop}>
<SectionAtmo audioFile={atmoAudioFile} />

<SectionContents section={section}
transitions={transitions}
backdrop={backdrop}
contentElements={contentElements}
state={state}
transitionStyles={transitionStyles} />

<SectionInlineFileRights section={section}
backdrop={backdrop}
atmoAudioFile={atmoAudioFile}
state={state} />
<BackgroundColorProvider dark={!section.invert}>
<SectionAtmo audioFile={atmoAudioFile} />

<SectionContents section={section}
transitions={transitions}
backdrop={backdrop}
contentElements={contentElements}
state={state}
transitionStyles={transitionStyles} />

<SectionInlineFileRights section={section}
backdrop={backdrop}
atmoAudioFile={atmoAudioFile}
state={state} />
</BackgroundColorProvider>
</SectionViewTimelineProvider>
</SectionLifecycleProvider>
</section>
Expand Down Expand Up @@ -146,15 +148,13 @@ function SectionContents({
state={state}
motifAreaState={motifAreaState}
staticShadowOpacity={staticShadowOpacity}>
<BackgroundColorProvider dark={!section.invert}>
<Layout sectionId={section.id}
items={contentElements}
appearance={section.appearance}
contentAreaRef={setContentAreaRef}
sectionProps={sectionProperties}>
{(children, boxProps) => <BoxWrapper {...boxProps} inverted={section.invert}>{children}</BoxWrapper>}
</Layout>
</BackgroundColorProvider>
<Layout sectionId={section.id}
items={contentElements}
appearance={section.appearance}
contentAreaRef={setContentAreaRef}
sectionProps={sectionProperties}>
{(children, boxProps) => <BoxWrapper {...boxProps} inverted={section.invert}>{children}</BoxWrapper>}
</Layout>
</Box>
</Foreground>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import React from 'react';
import classNames from 'classnames';
import {useDarkBackground} from 'pageflow-scrolled/frontend';

import styles from './TextInlineFileRights.module.css';

export function TextInlineFileRights({context, children}) {
const darkBackground = useDarkBackground();

if (context === 'insideElement' || context === 'playerControls') {
return null;
}

return (
<div className={classNames(styles.text,
{[styles.forSection]: context === 'section'})}>
{[styles.forSection]: context === 'section',
[styles.darkBackground]: darkBackground})}>
<div>
{children}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@value (
darkContentSurfaceColor, lightContentSurfaceColor,
darkContentTextColor, lightContentTextColor,
contentColorScope
) from "pageflow-scrolled/values/colors.module.css";

.text {
font-size: 14px;
position: relative;
Expand All @@ -10,14 +16,33 @@
padding-top: 0.2em;
}

.text li::before {
content: "© ";
opacity: 0.7;
}

.text:not(:has(li:nth-child(2))) span {
display: none;
}

.forSection {
position: absolute;
bottom: 0;
right: 0;
}

.forSection li {
padding: 0 0.4em 0.2em 0;
padding: 0.1em 0.3em;
border-radius: 0.25rem;
margin: 0 0.2em 0.1em auto;
background-color: color-mix(in srgb, lightContentSurfaceColor, transparent);
color: darkContentTextColor;
width: fit-content;
}

.forSection.darkBackground li {
background-color: color-mix(in srgb, darkContentSurfaceColor, transparent);
color: lightContentTextColor;
}

.text a {
Expand Down

0 comments on commit 7e6605e

Please sign in to comment.