Agregar estilos a botones de info los cursos

master
Araozu 2021-03-17 11:09:31 -05:00
parent 24af18473f
commit e5999c3141
2 changed files with 35 additions and 19 deletions

View File

@ -18,6 +18,10 @@ const e = StyleSheet.create({
contenedorCurso: { contenedorCurso: {
display: "inline-block", display: "inline-block",
verticalAlign: "top" verticalAlign: "top"
},
botonTexto: {
padding: "0.25rem 0.35rem",
borderRadius: "5px"
} }
}); });
@ -27,6 +31,13 @@ interface Props {
listaCursosUsuario: ListaCursosUsuario listaCursosUsuario: ListaCursosUsuario
} }
function IndicadorGrupo(props: { nombre: string, esLab: boolean }) {
return <span className={css(e.botonTexto, estilosGlobales.contenedorCursor, estilosGlobales.contenedorCursorSoft)}
style={props.esLab ? {"font-style": "italic"} : {"font-weight": "bold"}}>
{props.esLab ? "L" : ""}{props.nombre}
</span>
}
const agruparProfesores = (datos: { [k: string]: DatosVariante }) => { const agruparProfesores = (datos: { [k: string]: DatosVariante }) => {
const profesores: { [k: string]: string[] } = {}; const profesores: { [k: string]: string[] } = {};
for (const [grupo, datosGrupo] of Object.entries(datos)) { for (const [grupo, datosGrupo] of Object.entries(datos)) {
@ -43,16 +54,12 @@ export function Cursos(props: Props) {
const claseCursoNoAgregado = css( const claseCursoNoAgregado = css(
e.contenedorCurso, e.contenedorCurso,
estilosGlobales.contenedor, estilosGlobales.contenedor
// estilosGlobales.contenedorCursor,
// estilosGlobales.contenedorCursorSoft
); );
const claseCursoAgregado = css( const claseCursoAgregado = css(
e.contenedorCurso, e.contenedorCurso,
estilosGlobales.contenedor, estilosGlobales.contenedor,
// estilosGlobales.contenedorCursor,
// estilosGlobales.contenedorCursorSoft,
estilosGlobales.contenedorCursorActivo, estilosGlobales.contenedorCursorActivo,
); );
@ -73,8 +80,7 @@ export function Cursos(props: Props) {
: `Agregar a mi horario` : `Agregar a mi horario`
); );
const claseMemo = createMemo(() => const claseMemo = createMemo(() => cursoAgregadoMemo()
cursoAgregadoMemo()
? claseCursoAgregado ? claseCursoAgregado
: claseCursoNoAgregado : claseCursoNoAgregado
); );
@ -95,9 +101,9 @@ export function Cursos(props: Props) {
<span> <span>
{profesor}&nbsp; {profesor}&nbsp;
</span> </span>
<span style={{"font-weight": "bold"}}> <For each={grupos}>
{grupos.reduce((x, y) => x + " " + y)}&nbsp; {x => <IndicadorGrupo nombre={x} esLab={false}/>}
</span> </For>
</td> </td>
}} }}
</For> </For>
@ -109,16 +115,17 @@ export function Cursos(props: Props) {
<span> <span>
{profesor}&nbsp; {profesor}&nbsp;
</span> </span>
<span style={{"font-style": "italic"}}> <For each={grupos}>
{grupos.map(x => `L${x}`).reduce((x, y) => x + " " + y)}&nbsp; {x => <IndicadorGrupo nombre={x} esLab={true}/>}
</span> </For>
</td> </td>
}} }}
</For> </For>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<span className={css(estilosGlobales.contenedorCursor, estilosGlobales.contenedorCursorSoft)} <span
className={css(e.botonTexto, estilosGlobales.contenedorCursor, estilosGlobales.contenedorCursorSoft)}
onClick={() => props.fnAgregarCurso(datosCurso)} onClick={() => props.fnAgregarCurso(datosCurso)}
> >
{tituloMemo} {tituloMemo}

View File

@ -146,10 +146,19 @@ const procesarAnio = (data: AnioData, anio: string, version: number) => {
return obj; return obj;
} }
export function Tabla(props: { data: AnioData, anio: string, version: number }) { interface Props {
data: AnioData,
anio: string,
version: number,
idHover: () => string,
setIdHover: (v: string) => string
}
export function Tabla(props: Props) {
const anio = () => props.anio.substring(0, props.anio.indexOf(" ")); const anio = () => props.anio.substring(0, props.anio.indexOf(" "));
const data = createMemo(() => procesarAnio(props.data, anio(), props.version)); const data = createMemo(() => procesarAnio(props.data, anio(), props.version));
const [idHover, setIdHover] = createSignal(""); const idHover = props.idHover;
const setIdHover = props.setIdHover;
const celdas = createMemo(() => { const celdas = createMemo(() => {
// Hace reaccionar a la reactividad de Solid // Hace reaccionar a la reactividad de Solid