Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
refactor: Remove styled components
Browse files Browse the repository at this point in the history
  • Loading branch information
kulla committed Dec 14, 2023
1 parent a9a68fc commit ab2fd8b
Show file tree
Hide file tree
Showing 82 changed files with 71 additions and 925 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"shortid": "^2.0.0",
"slate": "^0.94.1",
"slate-react": "^0.99.0",
"styled-components": "^5.3.8",
"swr": "^2.2.4",
"ts-key-enum": "^2.0.12",
"ts-node": "^10.9.1",
Expand All @@ -130,7 +129,6 @@
"@types/react-syntax-highlighter": "^15.5.8",
"@types/shortid": "^0.0.29",
"@types/slate-react": "^0.50.1",
"@types/styled-components": "^5.1.26",
"@types/uuid": "^9.0.5",
"autoprefixer": "^10.4.16",
"cypress": "^12.17.4",
Expand Down
14 changes: 5 additions & 9 deletions src/frontend/plugins/serlo-injection/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import { SerloInjectionRenderer } from './renderer'
import { PluginToolbar } from '@/serlo-editor/editor-ui/plugin-toolbar'
import { PluginDefaultTools } from '@/serlo-editor/editor-ui/plugin-toolbar/plugin-tool-menu/plugin-default-tools'

const PlaceholderWrapper = styled.div({
position: 'relative',
width: '100%',
textAlign: 'center',
})

export const SerloInjectionEditor = (props: SerloInjectionProps) => {
const { focused, id } = props
const config = useSerloInjectionConfig(props.config)
Expand All @@ -41,7 +35,8 @@ export const SerloInjectionEditor = (props: SerloInjectionProps) => {
{cache ? (
<PreviewOverlay
focused={props.focused || false}
onChange={(nextActive) => {
// Todo: nextActive should be of type SetStateAction<boolean>
onChange={(nextActive: boolean | ((x: boolean) => boolean)) => {
setPreview(nextActive)
if (nextActive) {
setCache(props.state.value)
Expand All @@ -51,12 +46,12 @@ export const SerloInjectionEditor = (props: SerloInjectionProps) => {
<SerloInjectionRenderer contentId={cache} />
</PreviewOverlay>
) : (
<PlaceholderWrapper>
<div className="relative w-full text-center">
<FaIcon
icon={faNewspaper}
className="relative w-full text-center text-[5rem] text-gray-400"
/>
</PlaceholderWrapper>
</div>
)}

{props.focused && !preview ? (
Expand All @@ -70,6 +65,7 @@ export const SerloInjectionEditor = (props: SerloInjectionProps) => {
}}
width="30%"
inputWidth="100%"
tw={undefined}
/>
</div>
) : null}
Expand Down
17 changes: 7 additions & 10 deletions src/frontend/plugins/serlo-injection/renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import IframeResizer from 'iframe-resizer-react'

import styled from 'styled-components'

const Iframe = styled(IframeResizer)({
width: '1px',
minWidth: '100%',
border: '1px solid #ddd',
borderRadius: '2px',
})

export function SerloInjectionRenderer(props: {
contentId: string | undefined
}) {
const url = createURL(props.contentId)

return (
<Iframe
<IframeResizer
key={url}
src={url}
checkOrigin={false}
heightCalculationMethod="lowestElement"
sizeHeight
style={{
width: '1px',
minWidth: '100%',
border: '1px solid #ddd',
borderRadius: '2px',
}}
/>
)
}
Expand Down
Loading

0 comments on commit ab2fd8b

Please sign in to comment.