🐛🎨 Fix des éléments qui apparaissent à l'impression (#1966)
* 🐛🎨 Fix des élements qui apparaisent à l'impression * 🐛🎨 Fix des block vide à l'impression * 🐛🎨 Fix des types * 🐛💻 Ajout d'un check pour afficher le bouton d'impression * 🐛🎨 Fix des types * 🐛🎨 Amélioration visuel lors de l'impression * 🐛🎨 Suppression des marges autour du simulateur à l'impression * 🐛🎨 Supression d'une classe global css inutile * ✨ Fix typespull/2004/head
parent
88d0627c88
commit
dd20ce09c3
|
@ -38,7 +38,7 @@ function ChartItemBar({
|
|||
flex: display ? percentage : 0,
|
||||
})
|
||||
return (
|
||||
<div className="distribution-chart__bar-container ">
|
||||
<div className="distribution-chart__bar-container">
|
||||
{disableAnimation ? (
|
||||
<div
|
||||
className="distribution-chart__bar print-background-force"
|
||||
|
@ -105,20 +105,26 @@ export default function BarChartBranch({
|
|||
from: {
|
||||
opacity: 0,
|
||||
},
|
||||
immediate: disableAnimation,
|
||||
opacity: display ? 1 : 0,
|
||||
})
|
||||
return (
|
||||
|
||||
const innerBarChartBranch = (
|
||||
<InnerBarChartBranch
|
||||
value={value}
|
||||
display={display}
|
||||
maximum={maximum}
|
||||
title={title}
|
||||
unit={unit}
|
||||
icon={icon}
|
||||
description={description}
|
||||
/>
|
||||
)
|
||||
|
||||
return disableAnimation ? (
|
||||
innerBarChartBranch
|
||||
) : (
|
||||
<animated.div ref={intersectionRef} style={style}>
|
||||
<InnerBarChartBranch
|
||||
value={value}
|
||||
display={display}
|
||||
maximum={maximum}
|
||||
title={title}
|
||||
unit={unit}
|
||||
icon={icon}
|
||||
description={description}
|
||||
/>
|
||||
{innerBarChartBranch}
|
||||
</animated.div>
|
||||
)
|
||||
}
|
||||
|
@ -157,7 +163,7 @@ function InnerBarChartBranch({
|
|||
</Body>
|
||||
{description && <SmallBody>{description}</SmallBody>}
|
||||
</div>
|
||||
<Spacing md />
|
||||
<Spacing md className="print-hidden" />
|
||||
<ChartItemBar
|
||||
display={display}
|
||||
numberToPlot={value}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
.distribution-chart__bar {
|
||||
border-radius: 0.4em;
|
||||
|
||||
min-height: 1.5rem;
|
||||
}
|
||||
|
||||
|
@ -25,6 +24,9 @@
|
|||
.distribution-chart__bar {
|
||||
min-height: 1rem;
|
||||
}
|
||||
.distribution-chart__item {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
}
|
||||
|
||||
.distribution-chart__item-content {
|
||||
|
@ -35,41 +37,43 @@
|
|||
width: 35em;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.distribution-chart__legend {
|
||||
padding: 0;
|
||||
margin-bottom: -1.25rem;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
.distribution-chart__item {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.distribution-chart__legend {
|
||||
align-items: center !important;
|
||||
justify-content: flex-start !important;
|
||||
position: initial !important;
|
||||
flex-direction: column !important;
|
||||
padding-right: 0 !important;
|
||||
width: auto !important;
|
||||
height: initial !important;
|
||||
}
|
||||
.distribution-chart__counterparts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
width: auto;
|
||||
margin-bottom: 1rem;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.distribution-chart__bar {
|
||||
/* Enable printing of background color */
|
||||
min-height: 1.5em !important;
|
||||
}
|
||||
@media not print {
|
||||
@media (max-width: 600px) {
|
||||
.distribution-chart__legend {
|
||||
padding: 0;
|
||||
margin-bottom: -1.25rem;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
.distribution-chart__item {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.distribution-chart__legend {
|
||||
align-items: center !important;
|
||||
justify-content: flex-start !important;
|
||||
position: initial !important;
|
||||
flex-direction: column !important;
|
||||
padding-right: 0 !important;
|
||||
width: auto !important;
|
||||
height: initial !important;
|
||||
}
|
||||
.distribution-chart__counterparts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
width: auto;
|
||||
margin-bottom: 1rem;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.distribution-chart__bar {
|
||||
/* Enable printing of background color */
|
||||
min-height: 1.5em !important;
|
||||
}
|
||||
|
||||
.distribution-chart__branche-name {
|
||||
font-size: inherit !important;
|
||||
.distribution-chart__branche-name {
|
||||
font-size: inherit !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function SearchButton() {
|
|||
<PopoverWithTrigger
|
||||
title={t('Que cherchez-vous ?')}
|
||||
trigger={(buttonProps) => (
|
||||
<StyledButton light {...buttonProps}>
|
||||
<StyledButton className="print-hidden" light {...buttonProps}>
|
||||
<StyledIcon
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
|
|
|
@ -93,27 +93,23 @@ export default function ShareOrSaveSimulationBanner() {
|
|||
</PopoverWithTrigger>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sm="auto">
|
||||
<Button
|
||||
light
|
||||
size="XS"
|
||||
onPress={() => {
|
||||
window.print()
|
||||
}}
|
||||
>
|
||||
<Emoji
|
||||
css={`
|
||||
margin-right: 1rem;
|
||||
`}
|
||||
emoji="🖨"
|
||||
/>
|
||||
<ButtonLabel>
|
||||
<Trans i18nKey="ExportSimulation.Banner">
|
||||
Imprimer ou sauvegarder en PDF
|
||||
</Trans>
|
||||
</ButtonLabel>
|
||||
</Button>
|
||||
</Grid>
|
||||
{typeof window.print === 'function' && (
|
||||
<Grid item xs={12} sm="auto">
|
||||
<Button light size="XS" onPress={() => window.print()}>
|
||||
<Emoji
|
||||
css={`
|
||||
margin-right: 1rem;
|
||||
`}
|
||||
emoji="🖨"
|
||||
/>
|
||||
<ButtonLabel>
|
||||
<Trans i18nKey="ExportSimulation.Banner">
|
||||
Imprimer ou sauvegarder en PDF
|
||||
</Trans>
|
||||
</ButtonLabel>
|
||||
</Button>
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
</>
|
||||
)
|
||||
|
|
|
@ -161,8 +161,8 @@ const StyledGoal = styled.div`
|
|||
position: relative;
|
||||
z-index: 1;
|
||||
padding: ${({ theme }) => theme.spacings.sm} 0;
|
||||
`
|
||||
|
||||
const LogoContainer = styled.div`
|
||||
height: 3rem;
|
||||
@media print {
|
||||
padding: 0;
|
||||
}
|
||||
`
|
||||
|
|
|
@ -70,6 +70,11 @@ const StyledSimulationGoals = styled.div<
|
|||
: theme.colors.bases.primary
|
||||
return css`linear-gradient(60deg, ${colorPalette[800]} 0%, ${colorPalette[600]} 100%);`
|
||||
}};
|
||||
|
||||
@media print {
|
||||
background: initial;
|
||||
padding: 0;
|
||||
}
|
||||
`
|
||||
|
||||
function TopSection({ toggles }: { toggles?: React.ReactNode }) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Grid } from '@mui/material'
|
||||
import { Grid, styled } from '@mui/material'
|
||||
import { ConversationProps } from 'Components/conversation/Conversation'
|
||||
import PageFeedback from 'Components/Feedback'
|
||||
import ShareOrSaveSimulationBanner from 'Components/ShareSimulationBanner'
|
||||
|
@ -25,6 +25,15 @@ type SimulationProps = {
|
|||
customEndMessages?: ConversationProps['customEndMessages']
|
||||
}
|
||||
|
||||
const StyledGrid = styled(Grid)`
|
||||
@media print {
|
||||
max-width: initial;
|
||||
flex-basis: initial;
|
||||
flex-grow: 1;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
`
|
||||
|
||||
export default function Simulation({
|
||||
explanations,
|
||||
results,
|
||||
|
@ -38,26 +47,28 @@ export default function Simulation({
|
|||
{!firstStepCompleted && <TrackPage name="accueil" />}
|
||||
<ExportRecover />
|
||||
<Grid container spacing={2} justifyContent="center">
|
||||
<Grid item xl={9} lg={10} md={11} sm={12}>
|
||||
<StyledGrid item xl={9} lg={10} md={11} sm={12}>
|
||||
{children}
|
||||
|
||||
{!firstStepCompleted && (
|
||||
<>
|
||||
<PreviousSimulationBanner />
|
||||
{afterQuestionsSlot}
|
||||
</>
|
||||
)}
|
||||
<div className="print-hidden">
|
||||
{!firstStepCompleted && (
|
||||
<>
|
||||
<PreviousSimulationBanner />
|
||||
{afterQuestionsSlot}
|
||||
</>
|
||||
)}
|
||||
|
||||
{firstStepCompleted && (
|
||||
<FromTop>
|
||||
{results}
|
||||
<Questions customEndMessages={customEndMessages} />
|
||||
{afterQuestionsSlot || <Spacing sm />}
|
||||
<ShareOrSaveSimulationBanner />
|
||||
<Spacing lg />
|
||||
</FromTop>
|
||||
)}
|
||||
</Grid>
|
||||
{firstStepCompleted && (
|
||||
<FromTop>
|
||||
{results}
|
||||
<Questions customEndMessages={customEndMessages} />
|
||||
{afterQuestionsSlot || <Spacing sm />}
|
||||
<ShareOrSaveSimulationBanner />
|
||||
<Spacing lg />
|
||||
</FromTop>
|
||||
)}
|
||||
</div>
|
||||
</StyledGrid>
|
||||
</Grid>
|
||||
{firstStepCompleted && (
|
||||
<>
|
||||
|
|
|
@ -10,12 +10,14 @@ type InputSuggestionsProps = {
|
|||
suggestions?: Record<string, ASTNode>
|
||||
onFirstClick: (val: ASTNode) => void
|
||||
onSecondClick?: (val: ASTNode) => void
|
||||
className?: string
|
||||
}
|
||||
|
||||
export default function InputSuggestions({
|
||||
suggestions = {},
|
||||
onSecondClick = (x) => x,
|
||||
onFirstClick,
|
||||
className,
|
||||
}: InputSuggestionsProps) {
|
||||
const [suggestion, setSuggestion] = useState<ASTNode>()
|
||||
const { t } = useTranslation()
|
||||
|
@ -23,7 +25,7 @@ export default function InputSuggestions({
|
|||
return null
|
||||
}
|
||||
return (
|
||||
<StyledInputSuggestion>
|
||||
<StyledInputSuggestion className={className}>
|
||||
{toPairs(suggestions).map(([text, value]: [string, ASTNode]) => {
|
||||
return (
|
||||
<Link
|
||||
|
|
|
@ -75,6 +75,7 @@ export default function NumberInput({
|
|||
value={currentValue}
|
||||
/>
|
||||
<InputSuggestions
|
||||
className="print-hidden"
|
||||
suggestions={suggestions}
|
||||
onFirstClick={(node: ASTNode) => {
|
||||
const evaluatedNode = engine.evaluate(node)
|
||||
|
|
|
@ -63,7 +63,7 @@ export default function Footer() {
|
|||
|
||||
<Container backgroundColor={(theme) => theme.colors.bases.primary[700]}>
|
||||
<ThemeProvider theme={(theme) => ({ ...theme, darkMode: true })}>
|
||||
<FooterContainer>
|
||||
<FooterContainer className="print-hidden">
|
||||
<FooterColumn>
|
||||
{language === 'fr' && (
|
||||
<ul>
|
||||
|
|
|
@ -127,7 +127,7 @@ export const DistributionSection = ({
|
|||
}: {
|
||||
children?: React.ReactNode
|
||||
}) => (
|
||||
<section>
|
||||
<section className="print-no-break-inside">
|
||||
<H2>
|
||||
<Trans>À quoi servent mes cotisations ?</Trans>
|
||||
</H2>
|
||||
|
|
|
@ -47,6 +47,7 @@ export default function AnimatedTargetValue({
|
|||
}
|
||||
return (
|
||||
<div
|
||||
className="print-hidden"
|
||||
key={difference}
|
||||
css={`
|
||||
position: relative;
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
GenericButtonOrLinkProps,
|
||||
useButtonOrLink,
|
||||
} from 'DesignSystem/typography/link'
|
||||
import { forwardRef } from 'react'
|
||||
import React, { ForwardedRef, forwardRef } from 'react'
|
||||
import styled, { css } from 'styled-components'
|
||||
|
||||
type Size = 'XL' | 'MD' | 'XS'
|
||||
|
@ -16,22 +16,21 @@ type ButtonProps = GenericButtonOrLinkProps & {
|
|||
light?: boolean
|
||||
}
|
||||
|
||||
export const Button = forwardRef<
|
||||
HTMLAnchorElement | HTMLButtonElement,
|
||||
ButtonProps
|
||||
>(function Button(
|
||||
export const Button = forwardRef(function Button(
|
||||
{
|
||||
size = 'MD',
|
||||
light = false,
|
||||
color = 'primary' as const,
|
||||
className,
|
||||
...ariaButtonProps
|
||||
},
|
||||
forwardedRef
|
||||
}: ButtonProps,
|
||||
forwardedRef: ForwardedRef<HTMLAnchorElement | HTMLButtonElement>
|
||||
) {
|
||||
const buttonOrLinkProps = useButtonOrLink(ariaButtonProps, forwardedRef)
|
||||
return (
|
||||
<StyledButton
|
||||
{...buttonOrLinkProps}
|
||||
className={className}
|
||||
size={size}
|
||||
light={light}
|
||||
color={color}
|
||||
|
|
|
@ -34,10 +34,7 @@ export function Article({
|
|||
: 'div'
|
||||
|
||||
const ref = useRef<HTMLAnchorElement | HTMLButtonElement>(null)
|
||||
const { buttonProps } = useButton(
|
||||
{ elementType, ...ariaButtonProps },
|
||||
ref
|
||||
) as any
|
||||
const { buttonProps } = useButton({ elementType, ...ariaButtonProps }, ref)
|
||||
const titleProps = getTitleProps(title, 'h3')
|
||||
const linkProps = useExternalLinkProps({
|
||||
...(typeof title === 'string' ? { title } : {}),
|
||||
|
|
|
@ -8,8 +8,16 @@ const StyledGrid = styled(Grid)`
|
|||
|
||||
type FooterContainerProps = {
|
||||
children: ReactNode
|
||||
className?: string
|
||||
}
|
||||
|
||||
export const FooterContainer = ({ children }: FooterContainerProps) => {
|
||||
return <StyledGrid container>{children}</StyledGrid>
|
||||
export const FooterContainer = ({
|
||||
children,
|
||||
className,
|
||||
}: FooterContainerProps) => {
|
||||
return (
|
||||
<StyledGrid className={className} container>
|
||||
{children}
|
||||
</StyledGrid>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -157,6 +157,9 @@ button:enabled {
|
|||
.print-background-force {
|
||||
color-adjust: exact !important;
|
||||
}
|
||||
.print-no-break-inside {
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 00mm;
|
||||
|
|
|
@ -73,10 +73,14 @@ const OuterContainer = styled.div<OuterContainerProps>`
|
|||
min-width: 100vw;
|
||||
background-color: ${({ theme, backgroundColor }) =>
|
||||
backgroundColor ? backgroundColor(theme) : theme.colors};
|
||||
@media print {
|
||||
min-width: initial;
|
||||
}
|
||||
${InnerContainer} & {
|
||||
@media print {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0.5em;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
@ -85,4 +89,7 @@ const OuterOuterContainer = styled.div`
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
@media print {
|
||||
break-inside: avoid;
|
||||
}
|
||||
`
|
||||
|
|
|
@ -28,6 +28,10 @@ export const H1 = styled.h1<{ noUnderline?: boolean }>`
|
|||
`};
|
||||
line-height: 2.375rem;
|
||||
${({ noUnderline }) => (!noUnderline ? HeadingUnderline : '')}
|
||||
|
||||
@media print {
|
||||
margin: ${({ theme }) => theme.spacings.xl} 0;
|
||||
}
|
||||
`
|
||||
|
||||
export const H2 = styled.h2<{ noUnderline?: boolean }>`
|
||||
|
|
|
@ -3,6 +3,7 @@ import { AriaButtonProps } from '@react-types/button'
|
|||
import { FocusStyle } from 'DesignSystem/global-style'
|
||||
import React, {
|
||||
ComponentPropsWithRef,
|
||||
CSSProperties,
|
||||
ForwardedRef,
|
||||
useCallback,
|
||||
useRef,
|
||||
|
@ -83,14 +84,15 @@ export function useExternalLinkProps({
|
|||
}
|
||||
}
|
||||
|
||||
export type GenericButtonOrLinkProps =
|
||||
| ({
|
||||
href: string
|
||||
title?: string
|
||||
openInSameWindow?: true
|
||||
} & AriaButtonProps<'a'>)
|
||||
export type GenericButtonOrLinkProps = (
|
||||
| AriaButtonProps<'a'>
|
||||
| (AriaButtonProps<typeof NavLink> & ComponentPropsWithRef<typeof NavLink>)
|
||||
| AriaButtonProps<'button'>
|
||||
) & {
|
||||
openInSameWindow?: true
|
||||
className?: string
|
||||
style?: CSSProperties
|
||||
}
|
||||
|
||||
export function useButtonOrLink(
|
||||
props: GenericButtonOrLinkProps,
|
||||
|
@ -133,14 +135,15 @@ export function useButtonOrLink(
|
|||
...buttonProps,
|
||||
...useExternalLinkProps(props),
|
||||
as: elementType,
|
||||
ref: ref as any,
|
||||
} as any
|
||||
ref,
|
||||
}
|
||||
return buttonOrLinkProps
|
||||
}
|
||||
|
||||
export const NewWindowLinkIcon = () => {
|
||||
return (
|
||||
<StyledSvg
|
||||
className="print-hidden"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden
|
||||
fill="none"
|
||||
|
|
|
@ -53,7 +53,7 @@ export default function Simulateurs() {
|
|||
</Link>
|
||||
) : !isEmbedded ? (
|
||||
(!lastState || lastState?.fromSimulateurs) && (
|
||||
<Link to={sitePaths.simulateurs.index}>
|
||||
<Link className="print-hidden" to={sitePaths.simulateurs.index}>
|
||||
← <Trans>Voir les autres simulateurs</Trans>
|
||||
</Link>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue