mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(search) Make style.css depend on jte file changes
Also add a hack to ensure classes generated from java code get included in the stylesheet as intended.
This commit is contained in:
parent
deab9b9516
commit
6e1aa7b391
@ -92,9 +92,11 @@ task compileTailwind {
|
|||||||
def inputFile = file('tailwind/globals.css')
|
def inputFile = file('tailwind/globals.css')
|
||||||
def configFile = file('tailwind/tailwind.config.js')
|
def configFile = file('tailwind/tailwind.config.js')
|
||||||
def outputFile = file('resources/static/css/style.css')
|
def outputFile = file('resources/static/css/style.css')
|
||||||
|
def jteDir = file('resources/jte')
|
||||||
|
|
||||||
inputs.file inputFile
|
inputs.file inputFile
|
||||||
inputs.file configFile
|
inputs.file configFile
|
||||||
|
inputs.files fileTree(jteDir).include('**/*.jte')
|
||||||
outputs.file outputFile
|
outputs.file outputFile
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
|
@ -113,20 +113,21 @@ public class ClusteredUrlDetails implements Comparable<ClusteredUrlDetails> {
|
|||||||
return Objects.compare(first, o.first, UrlDetails::compareTo);
|
return Objects.compare(first, o.first, UrlDetails::compareTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PostColorScheme {
|
|
||||||
Slate("bg-white", "text-blue-800", "bg-blue-50", "text-black", "text-black"),
|
|
||||||
Green("bg-white", "text-green-800", "bg-green-50", "text-black", "text-black"),
|
|
||||||
Purple("bg-white", "text-purple-800", "bg-purple-50", "text-black", "text-black"),
|
|
||||||
White("bg-white", "text-blue-950", "bg-gray-100", "text-black", "text-black");
|
|
||||||
|
|
||||||
PostColorScheme(String backgroundColor, String textColor, String backgroundColor2, String textColor2, String descColor) {
|
public enum PostColorScheme {
|
||||||
|
// Hack: ensure these classes are also in jte/part/warmup.jte!
|
||||||
|
|
||||||
|
Slate( "text-blue-800", "bg-blue-50"),
|
||||||
|
Green( "text-green-800", "bg-green-50"),
|
||||||
|
Purple("text-purple-800", "bg-purple-50"),
|
||||||
|
White("text-blue-950", "bg-gray-100");
|
||||||
|
|
||||||
|
PostColorScheme(String textColor, String backgroundColor) {
|
||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
this.textColor = textColor;
|
this.textColor = textColor;
|
||||||
this.backgroundColor2 = backgroundColor2;
|
|
||||||
this.textColor2 = textColor2;
|
|
||||||
this.descColor = descColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static PostColorScheme select(UrlDetails result) {
|
public static PostColorScheme select(UrlDetails result) {
|
||||||
long encodedMetadata = result.resultItem.encodedDocMetadata;
|
long encodedMetadata = result.resultItem.encodedDocMetadata;
|
||||||
if (DocumentFlags.PlainText.isPresent(encodedMetadata)) {
|
if (DocumentFlags.PlainText.isPresent(encodedMetadata)) {
|
||||||
@ -145,8 +146,5 @@ public class ClusteredUrlDetails implements Comparable<ClusteredUrlDetails> {
|
|||||||
|
|
||||||
public final String backgroundColor;
|
public final String backgroundColor;
|
||||||
public final String textColor;
|
public final String textColor;
|
||||||
public final String backgroundColor2;
|
|
||||||
public final String textColor2;
|
|
||||||
public final String descColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
This is a bit of a hack!
|
||||||
|
|
||||||
|
This class exists to let tailwind we're using these classes even though they aren't visible in the code,
|
||||||
|
as we sometimes generate classes from Java code!
|
||||||
|
|
||||||
|
<i class="text-blue-800 bg-blue-50"></i>
|
||||||
|
<i class="text-green-800 bg-green-50"></i>
|
||||||
|
<i class="text-purple-800 bg-purple-50"></i>
|
||||||
|
<i class="text-blue-950 bg-gray-100"></i>
|
@ -2,12 +2,11 @@
|
|||||||
@import nu.marginalia.search.command.SearchParameters
|
@import nu.marginalia.search.command.SearchParameters
|
||||||
@import nu.marginalia.search.model.ClusteredUrlDetails
|
@import nu.marginalia.search.model.ClusteredUrlDetails
|
||||||
@import nu.marginalia.search.model.UrlDetails
|
@import nu.marginalia.search.model.UrlDetails
|
||||||
|
|
||||||
@param ClusteredUrlDetails result
|
@param ClusteredUrlDetails result
|
||||||
@param SearchParameters parameters
|
@param SearchParameters parameters
|
||||||
@param boolean domainSearch
|
@param boolean domainSearch
|
||||||
|
|
||||||
<div class="${result.colorScheme.backgroundColor} p-4 border border-gray-300 flex rounded">
|
<div class="bg-white p-4 border border-gray-300 flex rounded">
|
||||||
<div class="flex flex-col grow">
|
<div class="flex flex-col grow">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="flex flex-col grow" >
|
<div class="flex flex-col grow" >
|
||||||
@ -31,7 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="overflow-auto flex-1">
|
<div class="overflow-auto flex-1">
|
||||||
<p class="mt-2 text-sm ${result.colorScheme.descColor} leading-relaxed break-words">
|
<p class="mt-2 text-sm text-black leading-relaxed break-words">
|
||||||
$unsafe{result.first.descriptionHyphenHints()}
|
$unsafe{result.first.descriptionHyphenHints()}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -52,7 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (result.hasMultiple() && !domainSearch)
|
@if (result.hasMultiple() && !domainSearch)
|
||||||
<div class="flex mt-2 text-sm flex flex-col space-y-2">
|
<div class="flex mt-2 text-sm flex flex-col space-y-2">
|
||||||
<p class="${result.colorScheme.textColor2} ${result.colorScheme.backgroundColor2} p-1 rounded break-words hyphens-auto">Also from ${result.getDomain().toString()}:</p>
|
<p class="text-black ${result.colorScheme.backgroundColor} p-1 rounded break-words hyphens-auto">Also from ${result.getDomain().toString()}:</p>
|
||||||
|
|
||||||
<ul class="pl-2 mt-2 underline text-liteblue">
|
<ul class="pl-2 mt-2 underline text-liteblue">
|
||||||
@for(UrlDetails item : result.rest)
|
@for(UrlDetails item : result.rest)
|
||||||
|
Loading…
Reference in New Issue
Block a user