-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91450a7
commit de5eae5
Showing
28 changed files
with
912 additions
and
100 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { RmgFields, RmgFieldsField } from '@railmapgen/rmg-components'; | ||
import { MonoColour } from '@railmapgen/rmg-palette-resources'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { AttrsProps, CityCode } from '../../../../constants/constants'; | ||
import { | ||
LinePathAttributes, | ||
LinePathType, | ||
LineStyle, | ||
LineStyleComponentProps, | ||
LineStyleType, | ||
} from '../../../../constants/lines'; | ||
import { AttributesWithColor, ColorField } from '../../../panels/details/color-field'; | ||
|
||
const LondonLutonAirportDART = (props: LineStyleComponentProps<LondonLutonAirportDARTAttributes>) => { | ||
const { id, path, styleAttrs, handlePointerDown } = props; | ||
const { color = defaultLondonLutonAirportDARTAttributes.color } = | ||
styleAttrs ?? defaultLondonLutonAirportDARTAttributes; | ||
|
||
const onPointerDown = React.useCallback( | ||
(e: React.PointerEvent<SVGElement>) => handlePointerDown(id, e), | ||
[id, handlePointerDown] | ||
); | ||
|
||
return ( | ||
<g id={id} onPointerDown={onPointerDown} cursor="pointer"> | ||
<path d={path} fill="none" stroke={color[2]} strokeWidth="5" strokeLinecap="round" /> | ||
<path | ||
d={path} | ||
fill="none" | ||
stroke={color[3]} | ||
strokeWidth="3" | ||
strokeLinecap="round" | ||
strokeDasharray="0.001 6" | ||
/> | ||
</g> | ||
); | ||
}; | ||
|
||
/** | ||
* LondonLutonAirportDART specific props. | ||
*/ | ||
export interface LondonLutonAirportDARTAttributes extends LinePathAttributes, AttributesWithColor {} | ||
|
||
const defaultLondonLutonAirportDARTAttributes: LondonLutonAirportDARTAttributes = { | ||
color: [CityCode.London, 'rail', '#d6ae00', MonoColour.white], | ||
}; | ||
|
||
const londonLutonAirportDARTAttrsComponent = (props: AttrsProps<LondonLutonAirportDARTAttributes>) => { | ||
const { t } = useTranslation(); | ||
|
||
const fields: RmgFieldsField[] = [ | ||
{ | ||
type: 'custom', | ||
label: t('color'), | ||
component: ( | ||
<ColorField | ||
type={LineStyleType.LondonLutonAirportDART} | ||
defaultTheme={defaultLondonLutonAirportDARTAttributes.color} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return <RmgFields fields={fields} />; | ||
}; | ||
|
||
const londonLutonAirportDART: LineStyle<LondonLutonAirportDARTAttributes> = { | ||
component: LondonLutonAirportDART, | ||
defaultAttrs: defaultLondonLutonAirportDARTAttributes, | ||
attrsComponent: londonLutonAirportDARTAttrsComponent, | ||
metadata: { | ||
displayName: 'panel.details.lines.londonLutonAirportDART.displayName', | ||
supportLinePathType: [LinePathType.Diagonal, LinePathType.Perpendicular, LinePathType.RotatePerpendicular], | ||
}, | ||
}; | ||
|
||
export default londonLutonAirportDART; |
72 changes: 72 additions & 0 deletions
72
src/components/svgs/lines/styles/london-ifs-could-cable-car.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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { RmgFields, RmgFieldsField } from '@railmapgen/rmg-components'; | ||
import { MonoColour } from '@railmapgen/rmg-palette-resources'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { AttrsProps, CityCode } from '../../../../constants/constants'; | ||
import { | ||
LinePathAttributes, | ||
LinePathType, | ||
LineStyle, | ||
LineStyleComponentProps, | ||
LineStyleType, | ||
} from '../../../../constants/lines'; | ||
import { AttributesWithColor, ColorField } from '../../../panels/details/color-field'; | ||
|
||
const LondonIFSCloudCableCar = (props: LineStyleComponentProps<LondonIFSCloudCableCarAttributes>) => { | ||
const { id, path, styleAttrs, handlePointerDown } = props; | ||
const { color = defaultLondonIFSCloudCableCarAttributes.color } = | ||
styleAttrs ?? defaultLondonIFSCloudCableCarAttributes; | ||
|
||
const onPointerDown = React.useCallback( | ||
(e: React.PointerEvent<SVGElement>) => handlePointerDown(id, e), | ||
[id, handlePointerDown] | ||
); | ||
|
||
return ( | ||
<g id={id} onPointerDown={onPointerDown} cursor="pointer"> | ||
<path d={path} fill="none" stroke={color[2]} strokeWidth="5" /> | ||
<path d={path} fill="none" stroke="white" strokeWidth="3" /> | ||
<path d={path} fill="none" stroke={color[2]} strokeWidth="1" /> | ||
</g> | ||
); | ||
}; | ||
|
||
/** | ||
* LondonIFSCloudCableCar specific props. | ||
*/ | ||
export interface LondonIFSCloudCableCarAttributes extends LinePathAttributes, AttributesWithColor {} | ||
|
||
const defaultLondonIFSCloudCableCarAttributes: LondonIFSCloudCableCarAttributes = { | ||
color: [CityCode.London, 'dangleway', '#dc241f', MonoColour.white], | ||
}; | ||
|
||
const LondonIFSCloudCableCarAttrsComponent = (props: AttrsProps<LondonIFSCloudCableCarAttributes>) => { | ||
const { t } = useTranslation(); | ||
|
||
const fields: RmgFieldsField[] = [ | ||
{ | ||
type: 'custom', | ||
label: t('color'), | ||
component: ( | ||
<ColorField | ||
type={LineStyleType.LondonIFSCloudCableCar} | ||
defaultTheme={defaultLondonIFSCloudCableCarAttributes.color} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return <RmgFields fields={fields} />; | ||
}; | ||
|
||
const londonIFSCloudCableCar: LineStyle<LondonIFSCloudCableCarAttributes> = { | ||
component: LondonIFSCloudCableCar, | ||
defaultAttrs: defaultLondonIFSCloudCableCarAttributes, | ||
attrsComponent: LondonIFSCloudCableCarAttrsComponent, | ||
metadata: { | ||
displayName: 'panel.details.lines.londonIFSCloudCableCar.displayName', | ||
supportLinePathType: [LinePathType.Diagonal, LinePathType.Perpendicular, LinePathType.RotatePerpendicular], | ||
}, | ||
}; | ||
|
||
export default londonIFSCloudCableCar; |
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { RmgFields, RmgFieldsField } from '@railmapgen/rmg-components'; | ||
import { MonoColour } from '@railmapgen/rmg-palette-resources'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { AttrsProps, CityCode, Theme } from '../../../../constants/constants'; | ||
import { | ||
LinePathAttributes, | ||
LinePathType, | ||
LineStyle, | ||
LineStyleComponentProps, | ||
LineStyleType, | ||
} from '../../../../constants/lines'; | ||
import { ColorField } from '../../../panels/details/color-field'; | ||
|
||
const LondonRail = (props: LineStyleComponentProps<LondonRailAttributes>) => { | ||
const { id, path, styleAttrs, handlePointerDown } = props; | ||
const { | ||
colorBackground = defaultLondonRailAttributes.colorBackground, | ||
colorForeground = defaultLondonRailAttributes.colorForeground, | ||
limitedService = defaultLondonRailAttributes.limitedService, | ||
} = styleAttrs ?? defaultLondonRailAttributes; | ||
|
||
const onPointerDown = React.useCallback( | ||
(e: React.PointerEvent<SVGElement>) => handlePointerDown(id, e), | ||
[id, handlePointerDown] | ||
); | ||
|
||
return !limitedService ? ( | ||
<g id={id} onPointerDown={onPointerDown} cursor="pointer"> | ||
<path d={path} fill="none" stroke={colorBackground[2]} strokeWidth="5" strokeLinecap="round" /> | ||
<path d={path} fill="none" stroke={colorForeground[2]} strokeWidth="2" strokeDasharray="7 3" /> | ||
</g> | ||
) : ( | ||
<g id={id} onPointerDown={onPointerDown} cursor="pointer"> | ||
<path d={path} fill="none" stroke={colorBackground[2]} strokeWidth="5" strokeLinecap="round" /> | ||
<path d={path} fill="none" stroke={colorForeground[2]} strokeWidth="4.25" strokeLinecap="round" /> | ||
<path d={path} fill="none" stroke={colorBackground[2]} strokeWidth="2" strokeDasharray="7 3" /> | ||
</g> | ||
); | ||
}; | ||
|
||
/** | ||
* LondonRail specific props. | ||
*/ | ||
export interface LondonRailAttributes extends LinePathAttributes { | ||
colorBackground: Theme; | ||
colorForeground: Theme; | ||
limitedService: boolean; | ||
} | ||
|
||
const defaultLondonRailAttributes: LondonRailAttributes = { | ||
colorBackground: [CityCode.London, 'thameslink', '#d28db0', MonoColour.white], | ||
colorForeground: [CityCode.London, 'white', '#ffffff', MonoColour.black], | ||
limitedService: false, | ||
}; | ||
|
||
const londonRailAttrsComponent = (props: AttrsProps<LondonRailAttributes>) => { | ||
const { id, attrs, handleAttrsUpdate } = props; | ||
const { t } = useTranslation(); | ||
|
||
const fields: RmgFieldsField[] = [ | ||
{ | ||
type: 'switch', | ||
label: t('panel.details.lines.londonRail.limitedService'), | ||
oneLine: true, | ||
isChecked: attrs.limitedService, | ||
onChange: val => { | ||
attrs.limitedService = val; | ||
handleAttrsUpdate(id, attrs); | ||
}, | ||
minW: 'full', | ||
}, | ||
{ | ||
type: 'custom', | ||
label: t('panel.details.lines.londonRail.colorBackground'), | ||
component: ( | ||
<ColorField | ||
type={LineStyleType.LondonRail} | ||
colorKey="colorBackground" | ||
defaultTheme={defaultLondonRailAttributes.colorBackground} | ||
/> | ||
), | ||
}, | ||
{ | ||
type: 'custom', | ||
label: t('panel.details.lines.londonRail.colorForeground'), | ||
component: ( | ||
<ColorField | ||
type={LineStyleType.LondonRail} | ||
colorKey="colorForeground" | ||
defaultTheme={defaultLondonRailAttributes.colorForeground} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return <RmgFields fields={fields} />; | ||
}; | ||
|
||
const londonRail: LineStyle<LondonRailAttributes> = { | ||
component: LondonRail, | ||
defaultAttrs: defaultLondonRailAttributes, | ||
attrsComponent: londonRailAttrsComponent, | ||
metadata: { | ||
displayName: 'panel.details.lines.londonRail.displayName', | ||
supportLinePathType: [LinePathType.Diagonal, LinePathType.Perpendicular, LinePathType.RotatePerpendicular], | ||
}, | ||
}; | ||
|
||
export default londonRail; |
Oops, something went wrong.