-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite buttons components to use tailwind
- Loading branch information
Showing
11 changed files
with
67 additions
and
239 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
frontend/src/components/AppCrashFallback/AppCrashFallback.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
import styled from 'styled-components'; | ||
import { typography } from 'stylesheet'; | ||
import BaseButton from 'components/Button'; | ||
|
||
export const Title = styled.h1` | ||
${typography.h1} | ||
`; | ||
|
||
export const Button = styled(BaseButton)``; |
6 changes: 2 additions & 4 deletions
6
frontend/src/components/AppCrashFallback/AppCrashFallback.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 3 additions & 12 deletions
15
frontend/src/components/MobileFilterMenu/CloseButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { buttonCssResets } from 'services/cssHelpers'; | ||
|
||
interface Props { | ||
onClick: () => void; | ||
icon: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
export const CloseButton: React.FC<Props> = ({ onClick, className, icon }) => { | ||
export const CloseButton: React.FC<Props> = ({ icon, ...props }) => { | ||
return ( | ||
<Button type="button" onClick={onClick} className={className}> | ||
<button type="button" {...props}> | ||
{icon} | ||
</Button> | ||
</button> | ||
); | ||
}; | ||
|
||
const Button = styled.button` | ||
${buttonCssResets}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,26 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { borderRadius, colorPalette, getSpacing, typography, zIndex } from 'stylesheet'; | ||
import { buttonCssResets } from 'services/cssHelpers'; | ||
import { Map } from 'components/Icons/Map'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { useHideOnScrollDown } from 'hooks/useHideOnScrollDown'; | ||
import { Button } from 'components/Button'; | ||
import { cn } from 'services/utils/cn'; | ||
|
||
export const OpenMapButton: React.FC< | ||
React.ButtonHTMLAttributes<HTMLButtonElement> & { displayMap: () => void } | ||
> = ({ displayMap, ...nativeButtonProps }) => { | ||
const buttonDisplayState = useHideOnScrollDown(); | ||
|
||
return ( | ||
<MapButton | ||
<Button | ||
id="openMapButton" | ||
type="button" | ||
displayState={buttonDisplayState} | ||
className="flex desktop:hidden" | ||
className={cn( | ||
'fixed z-floatingButton flex gap-1 desktop:hidden border-0 rounded-full shadow-md left-1/2 -translate-x-1/2 transition-all', | ||
buttonDisplayState === 'HIDDEN' ? '-bottom-25' : 'bottom-6', | ||
)} | ||
{...nativeButtonProps} | ||
onClick={displayMap} | ||
> | ||
<FormattedMessage id="search.seeMap" /> | ||
<Map size={24} className="ml-1" /> | ||
</MapButton> | ||
<Map size={24} /> | ||
</Button> | ||
); | ||
}; | ||
|
||
const MapButton = styled.button<{ displayState: 'DISPLAYED' | 'HIDDEN' }>` | ||
${buttonCssResets} | ||
padding: ${getSpacing(3)} ${getSpacing(4)}; | ||
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.15); | ||
border-radius: ${borderRadius.roundButton}; | ||
${typography.main}; | ||
color: ${colorPalette.primary1}; | ||
position: fixed; | ||
z-index: ${zIndex.floatingButton}; | ||
bottom: ${({ displayState: showState }) => (showState === 'HIDDEN' ? '-100px' : getSpacing(6))}; | ||
/* Horizontally center the button */ | ||
left: 50%; | ||
transform: translateX(-50%); | ||
background-color: ${colorPalette.white}; | ||
transition-property: background-color bottom; | ||
transition-duration: 0.3s; | ||
transition-timing-function: ease-in-out; | ||
&:hover { | ||
background-color: ${colorPalette.primary2}; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.