diff --git a/frontend/package.json b/frontend/package.json index 11b2a8e..4b0abca 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,6 +28,7 @@ "date-fns": "^2.29.3", "leaflet": "^1.9.3", "matrix-widget-api": "^1.1.1", + "sass": "^1.58.3", "solid-js": "^1.6.6", "solid-transition-group": "^0.0.10" } diff --git a/frontend/src/App.module.css b/frontend/src/App.scss similarity index 57% rename from frontend/src/App.module.css rename to frontend/src/App.scss index a606582..9506539 100644 --- a/frontend/src/App.module.css +++ b/frontend/src/App.scss @@ -10,12 +10,14 @@ display: flex; text-align: center; -} -.panel { - min-width: 100%; - height: inherit; - width: inherit; + .panel { + min-width: 100%; + height: inherit; + width: inherit; - scroll-snap-align: center; + scroll-snap-align: center; + + background-color: var(--idfm-black); + } } diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 9678daa..9e517d1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,11 +3,12 @@ import { IVisibilityActionRequest, MatrixCapabilities, WidgetApi, WidgetApiToWid import { HopeProvider } from "@hope-ui/solid"; import { BusinessDataProvider } from './businessData'; -import { SearchProvider } from './search'; -import { PassagesDisplay } from './passagesDisplay'; -import { StopsManager } from './stopsManager'; +import { AppContextProvider } from './appContext'; -import styles from './App.module.css'; +import { PassagesDisplay } from './passagesDisplay'; +import { StopsSearchMenu } from './stopsSearchMenu'; + +import "./App.scss"; function parseFragment() { @@ -44,18 +45,18 @@ const App: Component = () => { return ( - + -
-
- +
+
+
-
+
- + ); }; diff --git a/frontend/src/passagesDisplay.module.css b/frontend/src/_common.scss similarity index 58% rename from frontend/src/passagesDisplay.module.css rename to frontend/src/_common.scss index 243740b..c77e86b 100644 --- a/frontend/src/passagesDisplay.module.css +++ b/frontend/src/_common.scss @@ -1,14 +1,12 @@ /* Idfm: 1860x1080px */ -.passagesDisplay { +%widget { aspect-ratio: 16/9; --reverse-aspect-ratio: 9/16; /* height is set according to the aspect-ratio, don“t touch it */ width: 100%; - - display: flex; - flex-direction: column; - background-color: var(--idfm-black); + display: flex; + flex-direction: column; } /* Idfm: 1800x100px (margin: 17px 60px) */ @@ -18,79 +16,46 @@ /*Percentage margin are computed relatively to the nearest block container's width, not height */ /* cf. https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom */ margin: calc(17/1080*var(--reverse-aspect-ratio)*100%) calc(60/1920*100%); - + display: flex; align-items: center; font-family: IDFVoyageur-bold; } -.header .transportMode { - aspect-ratio: 1/1; - height: 100%; - margin: 0; - margin-right: calc(23/1920*100%); -} - -.header .title { +// .header .title { +%title { height: 50%; width: 70%; margin-right: auto; } -.header .menu { - height: calc(80/100*100%); - aspect-ratio: 1; - margin-right: calc(30/1920*100%); -} -.header .menu button { - height: 100%; - aspect-ratio: 1; - - background-color: var(--idfm-black); - border: solid var(--idfm-white) 3px; - border-radius: calc(9/86*100%); -} - -.header .clock { - width: calc(175/1920*100%); - height: calc(80/100*100%); - - display: flex; - align-items: center; - justify-content: center; - - border:solid var(--idfm-white) 3px; - border-radius: calc(9/86*100%); -} - -.header .clock svg { - aspect-ratio: 2.45; - height: calc(0.7*100%); -} /* Idfm: 1860x892px (margin: 0px 30px) */ -.panelsContainer { +%body { width: calc(1860/1920*100%); height: calc(892/1080*100%); margin: 0 calc(30/1920*100%); - + display: flex; flex-direction: column; - + background-color: white; - + border-collapse:separate; - border:solid var(--idfm-black) 1px; + // border:solid var(--idfm-black) 1px; border-radius: calc(15/1920*100%); } + + + /* Idfm: 1800x54px (margin: 0px 50px) */ .footer { width: calc(1820/1920*100%); - height: calc(54/1080*100%); + height: calc(54/1080*100%); margin: 0 calc(50/1920*100%); display: flex; diff --git a/frontend/src/_utils.scss b/frontend/src/_utils.scss new file mode 100644 index 0000000..7c0d7f0 --- /dev/null +++ b/frontend/src/_utils.scss @@ -0,0 +1,31 @@ +%transportMode { + aspect-ratio : 1 / 1; +} + +%linePicto { + font-family: IDFVoyageur-bold; +} + +%tramLinePicto { + @extend %linePicto; + + aspect-ratio : 1 / 1; +} + +%trainLinePicto { + @extend %linePicto; + + aspect-ratio : 1 / 1; +} + +%metroLinePicto { + @extend %linePicto; + + aspect-ratio : 1 / 1; +} + +%busLinePicto { + @extend %linePicto; + + aspect-ratio : 2.25; +} diff --git a/frontend/src/index.css b/frontend/src/index.scss similarity index 100% rename from frontend/src/index.css rename to frontend/src/index.scss diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 3fe2a6a..4f244f7 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -1,7 +1,7 @@ /* @refresh reload */ import { render } from 'solid-js/web'; -import './index.css'; +import './index.scss'; import App from './App'; render(() => (), document.getElementById('root') as HTMLElement); diff --git a/frontend/src/passagesDisplay.scss b/frontend/src/passagesDisplay.scss new file mode 100644 index 0000000..2fc8d35 --- /dev/null +++ b/frontend/src/passagesDisplay.scss @@ -0,0 +1,60 @@ +@use "_common"; +@use "_utils"; + +.passagesDisplay { + @extend %widget; + + .header { + $header-element-height: calc(80/100*100%); + $component-border: solid var(--idfm-white) calc(0.25*1vh); + $component-border-radius: calc(9/86*100%); + .transportMode { + @extend %transportMode; + + height: 100%; + margin: 0; + margin-right: calc(23/1920*100%); + } + + .title { + @extend %title; + } + + .menu { + height: $header-element-height; + aspect-ratio: 1; + margin-right: calc(30/1920*100%); + margin-left: auto; + + button { + height: 100%; + aspect-ratio: 1; + + background-color: var(--idfm-black); + border: $component-border; + border-radius: $component-border-radius; + } + } + + .clock { + width: calc(175/1920*100%); + height: $header-element-height; + + display: flex; + align-items: center; + justify-content: center; + + border: $component-border; + border-radius: $component-border-radius; + + svg { + aspect-ratio: 2.45; + height: calc(0.7*100%); + } + } + } + + .body { + @extend %body + } +} diff --git a/frontend/src/passagesDisplay.tsx b/frontend/src/passagesDisplay.tsx index b705f60..a900ad8 100644 --- a/frontend/src/passagesDisplay.tsx +++ b/frontend/src/passagesDisplay.tsx @@ -11,7 +11,6 @@ import { getTransportModeSrc } from "./utils"; import { PassagesPanel } from "./passagesPanel"; import { IconHamburgerMenu } from './extra/iconHamburgerMenu'; -import styles from "./passagesDisplay.module.css"; type PositionnedPanel = { @@ -19,6 +18,7 @@ type PositionnedPanel = { // TODO: Should be PassagesPanelComponent ? panel: JSX.Element; }; +import "./passagesDisplay.scss"; interface PassagesDisplayStore { @@ -122,24 +122,24 @@ const Header: VoidComponent<{ title: string }> = (props) => { }); return ( -
+
{(url) => -
+
} -
+
{props.title}
-
+ -
+
{format(dateNow(), "HH:mm")} @@ -171,7 +171,7 @@ const Footer: VoidComponent<{}> = () => { const { getDisplayedPanelId, getPanels } = passagesDisplayStore; return ( -
+